1. 程式人生 > >vue 元件的銷燬重建

vue 元件的銷燬重建

程式碼:<v-detection :detectionid="detectionid" v-if="hackReset"></v-detection>

宣告hackReset,利用true或者false實現重建或者銷燬

程式碼:
     this.hackReset = false;//銷燬元件
     this.$nextTick(() => {
       this.hackReset = true;//重建元件
     });