微信小程序是之 wxs 方法
2021-12-07 本文已影响0人
缓慢的蜗牛
1.在根目录 创建wxs 文件夹

2.创建wxs/public.wxs 文件

3.挂在公共方法public
var public = {
// 折叠方法
collapseState:function (collapseActive, collapseActiveItem) {
if (collapseActive.indexOf(collapseActiveItem) >= 0) {
return true;
} else {
return false;
}
}
};
module.exports.public = public;
4.页面内引入wxs
<wxs src="./../../wxs/public.wxs" module="public"></wxs>
说明:module="public" 为方法名

5.使用

