且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用小胡子填写html标签参数

更新时间:2023-12-01 08:24:40

您需要在href中添加{{id}},如下所示:

You need to add the {{id}} in the href, like that :

href="#product_detail?{{id}}"

我们过去通常将胡须模板放在类型为"text/template"的脚本中,我不知道它是否可以解决您的转义问题,但我们不在这里.

We used to put our mustache template in a script with type="text/template", i don't know if it will solve your escaping problems but we haven't here.

<script type="text/template" id="tmpl">
   <a href href="#product_detail?{{id}}">link</a>
</script>

如果遇到一些转义问题,请使用&在这样的ID之前:

If you got some escaping problems use the & before the id like that:

<script type="text/template" id="tmpl">
   <a href href="#product_detail?{{& id}}">link</a>
</script>

希望对您有所帮助!