查了很多资料,解决办法各异,但以下两个没有用
(1)this.$forceUpdate()强制更新渲染,没用。
(2)使用v-if和this.ifPanel = false去控制el-cascader的显示,目的也是重新渲染,没用
this.ifPanel = false
this.$nextTick(function () {
this.channel_type.splice(0,1)
this.ifPanel = true
})
(3)使用v-if和setTimeOut,没用
this.ifPanel = false;
this.channel_type.splice(0,1)
let _this = this;
setTimeout(function(){_this.ifPanel=true;}, 0 )
最终解决方案,使用key
<el-cascader
。。。。
@change="pageChange"
:key="propsKey"></el-cascader>
每次改变v-model,this.propsKey++,但是需要注意,key的值不能跟页面其他key重复,不然会报错如下,可以初始化为1000