vue3 setup语法中数据更新视图不更新问题解决

在使用vue3的过程中,有使用到二维数组的场景,在对内部数组进行操作时,响应式的value值已经发生改变,但是视图还未修改,目前使用强制刷新解决该问题了,代码如下

import {
    
     defineComponent , ref , computed , toRefs , getCurrentInstance} from 'vue'
setup(){
    
    
const internalInstance = getCurrentInstance()
//操作数据后更新视图
internalInstance.ctx.$forceUpdate()
return {
    
    
internalInstance
}
}


	```

猜你喜欢

转载自blog.csdn.net/weixin_44064067/article/details/124258711