我有一个Vue.js x-template渲染脚本,并且想使用Underscore.js _.template()
模板引擎而不是默认的无逻辑Handlebars语法。正如我需要添加if循环和一些其他的JS逻辑(Handlebars语法未提供)那样。我该如何实施这样的解决方案?
Vue组件代码:
Vue.component('tmpl-heading',
template: '#tmpl-heading',
props: ['settings']
)
X-template脚本标记:
<script type="text/x-template" id="tmpl-heading">
<h1>{{ settings.text }}</h1>
</script>