Note: 提供一个多模板解析插件
wepy-compiler-view
,唯一的遗憾,就是在编辑器中没有展示高亮语法提示。如果有使用pug/jade模版的同学,可以直接戳wepy-compiler-pug
插件,把wpy扩展名改成vue之后,就有高亮语法提示了。
- atpl
- bracket
- doT.js (website)
- dust (unmaintained) (website)
- dustjs-linkedin (maintained fork of dust) (website)
- eco
- ect (website)
- ejs (website)
- haml
- haml-coffee
- hamlet
- handlebars (website)
- hogan (website)
- htmling
- jade (website)
- jazz
- jqtpl
- JUST
- liquor
- lodash (website)
- marko (website)
- mote (website)
- mustache
- nunjucks (website)
- plates
- pug (formerly jade) (website)
- QEJS
- ractive
- react
- slm
- swig (unmaintained)
- swig (maintained fork)
- teacup
- templayed
- twig
- liquid (website)
- toffee
- underscore (website)
- vash
- walrus (website)
- whiskers
NOTE: you must still install the engines you wish to use, add them to your package.json dependencies.
cnpm install wepy-compiler-view --save-dev
// configure wepy.config.js
module.exports = {
compilers: {
view: {
engine: 'ejs',
render: promise, // (选填)自定义渲染函数,支持promise
globalConfig: { // 这个属性名字可以随便定义,只要在模板中使用相同的名字即可
imgUrlPrefix: ''
}
}
}
};
// write vue/wpy template
<template lang="view">
view
image(src=`${globalConfig.imgUrlPrefix}/images/xxx.svg`)
</template>