vue3 中强制更新视图 方式
通过 $forceUpdate 与 vue2 相似
import {getCurrentInstance} from 'vue' const internalInstance = getCurrentInstance() //操作数据后更新视图 internalInstance.ctx.$forceUpdate()
复制
通过 key 值改变更新
<compName :key="key" /> const onChangeKey = ()=> { key.value = Date.now(); }
复制