使用 Pug 语言时 Vue 模板的"Mustache"语法替代方案



"Mustache"语法允许定义如下数据:

<template>
<Window>
<template v-slot:title >
{{title}}
</template>
</Window>
</template>

但是用lang='pug'编译失败:

<template lang='pug'>
<Window>
<template v-slot:title >
{{title}}
</template>
</Window>
</template>

出现此错误:

模块构建失败:意外文本"{{quot;…

其他不使用mustache语法的模板使用lang='pug'构建良好。Pugmustache语法的替代方案是什么?

请注意,Pug模板的内容实际上不是Pug语法,但除此之外:

在Pug中,明文应该在标签(例如span(内,或者以管道字符为前缀

<template lang="pug">
Window
template(v-slot:title="")
| {{title}}
</template>

演示

最新更新