导航栏: 首页 评论列表

template标签小坑一记

默认分类 2017/12/23 20:08

template标签中的内容必须符合HTML规范。这好象是句废话,其实不然,当模板中有代替化字符时,不一定完全符合HTML规范的,如

<template type="text/template" id="pageIndex">
  <td attr="{{"Add_New_List"|lang}}" prop="{{"Edit_List"|lang}}">&nbsp;</td>
</template>

会解析成

<template type="text/template" id="pageIndex">
  <td attr="{{" add_new_list"|lang}}"="" prop="{{" edit_list"|lang}}"="">&nbsp;</td>
</template>

解决方法1,修改成符合HTML语法规范

<template type="text/template" id="pageIndex">
  <td attr="{{'Add_New_List'|lang}}" prop="{{'Edit_List'|lang}}">&nbsp;</td>
</template>

解决方法2,使用script标签

<script type="text/template" id="pageIndex">
  <td attr="{{"Add_New_List"|lang}}" prop="{{"Edit_List"|lang}}">&nbsp;</td>
</script>


>> 留言评论