vue3中数据更新,视图没有更新解决方案

Vue 3.0 中我们使用 reactive() 定义的响应式数据的时候,当我们对象再次赋值,我们发现数据已经修改成功,但是页⾯并没有自动渲染成最新的数据;

使用vue的强制刷新处理

<scriptsetup>

import {defineComponent , ref , computed , toRefs , getCurrentInstance} from 'vue'

constinternalInstance = getCurrentInstance()

//操作数据后更新视图 例如tabledata= xxx后

internalInstance.ctx.$forceUpdate()

}

</script>

猜你喜欢

转载自blog.csdn.net/Yang_Ming_Lei/article/details/129770586