link_to_tag
该 helper 用于生成一个带 href 属性 的 <a> 标签,该链接会包含传入的指定标签,用于跳转到当前所在的分类列表页,跳转后的新页面过滤显示指定标签商品。
目前该 helper 仅支持分类列表页使用, 其他页面不支持。
参数
tag{String}商品类型, 必填hash.text{String}text 用于生成a标签显示内容文本,若传入非字符串将默认转为空字符串[attribute]{Object}表单html属性,可选,格式:class="_class"returns{String}html
用法
{{ link_to_tag tag [attribute] }}
例子
{{#each collection.all_tags as |tag|}}
{{#if (contains ../current_tags tag) }}
{{ tag }}
{{else}}
{{ link_to_tag tag class="link-class" title=tag text=tag }}
{{/if}}
{{/each}}
这篇文章对你有帮助吗?
SHOPLINE