收藏
回答

picker我并没有触发bindchange事件,为什么wenti的值也在跟着变?

 //js

data:{
               multiIndex0,
        multiArray: [],
        yuanxiku: [],
        wenti:[]
},


// 多项选择器点击确定事件
    bindMultiPickerChangefunction (e{
        console.log('picker发送选择改变,携带值为', e.detail.value)
        if (e.detail.value.length == 0) {
            return
        }
        else{
            this.setData({
                multiIndex: e.detail.value,
                wenti:this.data.multiArray
            })
        }
    },


    // 多项选择器滑动事件
    bindMultiPickerColumnChangefunction (e{
        console.log('column', e.detail.column)
        console.log('value', e.detail.value)
        let data = {
            multiArraythis.data.multiArray,
        };
        if (e.detail.column == 0) {
            console.log('滑动')
            data.multiArray[1] = this.data.yuanxiku[e.detail.value];
        }
        this.setData(data);
    },

//wxml
 <picker class="xuexiaoxuanze" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}" bindcancel="quxiao">
        <view class="picker" wx:if="{{multiIndex}}">
            {{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}
        </view>
        <view wx:if="{{!multiIndex}}" class="tishi">请选择院系与专业</view>
    </picker>



回答关注问题邀请回答
收藏

1 个回答

  • 沐木
    沐木
    2022-11-19

    2022-11-19
    有用
    回复
登录 后发表内容