Vue在父组件中重新渲染子组件
在父组件中添加如下代码<template><Child v-if="hackReset" :time_range='time_picked' /></template><script>ex
·
在父组件中添加如下代码
<template>
<Child v-if="hackReset" :time_range='time_picked' />
</template>
<script>
export default{
data(){
return {
hackSet:false,
}
}
methods:{
//需要重新渲染时调用aaa
aaa() {
this.hackReset = false;
this.$nextTick(() => {
this.hackReset = true
})
}
}
}
</script>
$nextTick()
Defer the callback to be executed after the next DOM update cycle. Use it immediately after you’ve changed some data to wait for the DOM update.
更多推荐
已为社区贡献1条内容
所有评论(0)