写微信小程序项目的时候 遇到多选框选值通过id来判断内容切换
这里是通过wxs来实现的
wxml
<wxs module="calc">
function getId(arr, id) {
return arr.indexOf(id)
}
module.exports = {
getId: getId,
}
</wxs>
<view class="lb1">
<view class="lb2">
经营
</view>
<view class="lb3" bindtap="showDialog">
<text class="weui" wx:for="{
{list}}">{
{item}}</text>
</view>
</view>
<!-- 多选 -->
<view class="free-dialog {
{ showDialog ? 'free-dialog--show' : '' }}">
<view class="free-dialog__mask" />
<view class="free-dialog__container">
<view style="padding: 5% 5% 15%;">
<view class="end">
<view