0.0.4 • Published 5 years ago
wxtovue v0.0.4
wxtovue
将微信小程序代码转换成vue代码
安装
npm install -g wxtovue
使用
var transformer = require('wxtovue'); transformer.toHtml('{{123}}'); //{{123}}
var options = {
mapping: {
view: 'section',
text: (element, helper) => {
return <span data-wxa="text" ${helper.propsStringify(element.props)}>
+
${helper.childrenStringify(element.children, options)}</span>
;
}
}
};
transformer.toHtml('{{123}} 456', options);
//{{123}} 456
transformer.toObject('{{123}}'); //{tag:'view', props:{name:'id', value:'box'}, children: {'{{123}}'} }
transformer.toObject('{{123}}'); //{tag:'view', props:{name:'id', value:'box'}, {name:'hidden', onlyName:true}, children: {'{{123}}'} }
## 更新日志
20190801,第一次更新