问题this.$nextTick(()=>{this.$refs.multipleTable.toggleAllSelection()this.isChecked=false})注意:this.$refs.multipleTable.toggleAllSelection()必须放在this.$nextTick()里面执行才能生效如上所示我希望先执行this.$refs.multipleTable.toggleAllSelection(),再this.isChecked=false,但是经过测试发现this.isChecked=false总是在前执行导致页面渲染不正确弱鸡解决法this.$nextTick(()=>{this.$refs.multipleTable.toggleAllSelection()setTimeout(()=>{this.isChecked=false},100);})这样可以解决这个问题,但是总感觉不太好尝试过封装asyncawit但是无效如下:constnextTickAsync=()=>{returnnewPromise((resolve,reject)=>{this.$nextTick(()=>{this.$refs.multipleTable.toggleAllSelection();resolve(true)})})}constisCheckedAsycn=()=>{returnnewPromise((resolve,reject)=>{this.$nextTick(()=>{this.isChecked=falseresolve(true)})})}(async()=>{awaitnextTickAsync()awaitisCheckedAsycn()})()求问解决方法?如何先执行完this.$nextTick()在执行后续的this.isChecked=false
2 回答
PIPIONE
TA贡献1829条经验 获得超9个赞
this.$refs.multipleTable.toggleAllSelection()this.$nextTick(()=>{this.isChecked=false})
慕田峪4524236
TA贡献1875条经验 获得超5个赞
注意:this.$refs.multipleTable.toggleAllSelection()必须放在this.$nextTick()里面执行才能生效
添加回答
举报
0/150
提交
取消