<code><script type="text/template" id="item-template"> <div class="view"> <input type="checkbox" class="toggle" {{ completed ? "checked" : "" }} > <label for="">{{title}} <input type="button" class="destroy" /> <input type="button" value="{{title}}" class="edit"> </script> 里面的{{ completed ? "checked" : "" }}貌似解析不了,请问是该模板语言不支持吗?(mustache.js) 抱歉,问题解决了,是我把mustache当成了后端的smarty语言,`{{#completed}}checked{{/completed}}`这样就可以了,completed为真就显示,否则不输出</code>
<code><script type="text/template" id="item-template"> <div class="view"> <input type="checkbox" class="toggle" {{ completed ? "checked" : "" }} > <label for="">{{title}} <input type="button" class="destroy" /> <input type="button" value="{{title}}" class="edit"> </script> 里面的{{ completed ? "checked" : "" }}貌似解析不了,请问是该模板语言不支持吗?(mustache.js) 抱歉,问题解决了,是我把mustache当成了后端的smarty语言,`{{#completed}}checked{{/completed}}`这样就可以了,completed为真就显示,否则不输出</code>