vue重新加载组件 进行数据重新赋值

方法一

<router-view :key="当前时间戳即可">
router-view>

<select-tree-modal :info="typeCPZY"  @ok="setCPZY"  v-decorator="['assessmentMajor', {}]" :treeChild="cpzyID" :key="getTime()">select-tree-modal>


      getTime(){
        var timestamp=new Date().getTime();
        console.log(timestamp);
        return timestamp;
      }

方法二

<template>
<router-view v-if="isRouterAlive"/>
template>
<script>
export default {
 data () {
   return {
     isRouterAlive: true
   }
 },
 methods: {
   reload () {
     this.isRouterAlive = false
     this.$nextTick(() => (this.isRouterAlive = true))
   }   
 }
}
script>

你可能感兴趣的:(VUE学习,vue,js)