twh-preview
v2.0.10
Published
页面渲染服务SDK
Downloads
5
Readme
twh-preview
渲染服务预览npm包
Installation
$ npm install twh-preview
Usage
page结构
const preview = require('twh-preview');
const config = {
"page": {
"templates": {
"index.xtpl": " {{$system.isAliIntranet}} haha demo {{ include ('./age.xtpl')}}", //模板入口,必选
'age.xtpl': '{{$data.age}}',
"seed.json": "{}" //seed依赖,可选
}
},
"data": {
"age": "爱的色放l1撒发" //(mock数据,可选)
},
"intranet": true //是否内网,默认true (可选)
};
preview(config).then(data => {
console.log(data)
}).catch();
代码片段结构
const preview = require('twh-preview');
const config = {
'page': {
'name': 'fdemo', // 代码片段path值,必选。必须符合JS函数命名规范
'preview': 'fragment', // 必选,值必须是"fragment"
'templates': {
'index.xtpl': `{{$system.isAliIntranet}} haha demo {{ include ('./age.xtpl')}}`, //模板入口,必选
'age.xtpl': '{{$data.age}}',
'seed.json': '{}', //seed依赖,可选
},
},
'data': {
'age': '好老好老啊', //(mock数据,可选)
},
'intranet': true, //是否内网,默认true (可选)
};
preview(config).then(data => {
console.log(data)
}).catch();