1 使用
在wxml中创建<wxs module="tools"></wxs> 标签, 将代码都写在这个标签中
创建一个方法
<wxs module="tools" >
function reateNames(names){
console.log(names)
return names.split(",")
}
module.exports =reateNames;
</wxs>
使用这个方法
<view
wx:for="{{tools(names)}}"
>
{{item}}
</view>
js文件的data中
data:{
names:"abc,233,ccc"
}
**************************************************************************************************************************
2 创建一个wxs的文件
3 wxml中引入wxs文件
<wxs module="too" src="./tool.wxs"></wxs>
使用
too()
**************************************************************************************************************************
**************************************************************************************************************************