详细问题描述
uni-data-select 组件,通过v-model绑定数据后,选择属性, 触发change事件,在事件中查看源数据,发现源数据未更新,需要添加延迟后才有更新
重现步骤
[步骤]
代码如下:
<template>
<view>
<view :style="swiperStyle" class=".swiper-box">
<swiper :current="currentView" class=".swiper-swiper" style="min-height: 100%">
<swiper-item>
<scroll-view scroll-y="true" style="height:100%">
<view>
<uni-data-select v-model="test.defaultVal" :localdata="test.list" @change="onPropItemChange(test)"></uni-data-select></view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
export default {
data() {
return {
swiperStyle: {
'height': '80vh'
},
currentView:0,
test:{list:[{text: '是', value: 1}, {text: '否', value: 0}],defaultVal:""}
}
},
computed:{
},
onLoad(options) {
},
methods: {
onPropItemChange(prop){
// console.log(e);
console.log(this.test);
// console.log(this.checkTaskList);
setTimeout(()=>{
console.log(this.test);
}, 1000)
}
}
}
</script>
<style></style>
[结果]
需要添加延时后,才能看到改变后的源数据。
运行环境
[HBuilder版本]
HbuilderX 3.6.18.20230117
[插件版本]
uni-data-select@1.0.5
[测试设备]
EMUI 8.0.0
风小舞 (作者)
是的呢 , 干脆放弃用他的@change,换其他方法吧
2023-03-13 10:53