在父组件中添加如下代码

  <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.

JS事件循环

Logo

前往低代码交流专区

更多推荐