使用underscore.js模板功能渲染Vue.js x-template

时间:2019-04-26 09:21:09

标签: vue.js underscore.js underscore.js-templating

我有一个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>

0 个答案:

没有答案