vue3.0 refresh the current component nextTick

Foreword:

       In vue2.0 we want to refresh a component of words is in data define a variable inside and methods directly inside this. $ NextTick directly call this function to operate in vue3.0 the setup of his usage is not the same

Usage in setup:

1. Introduce reactive and nextTick 


import { reactive,nextTick  } from 'vue'

2. Define variables in setup

setup (props, ctx) {
 //定义变量
 let table = reactive({
      showTable: true
    })
 //使用刷新
 table.showTable = false
 nextTick(()=>{
    //写入操作
     table.showTable = true
  })
}

 

Guess you like

Origin blog.csdn.net/qq_41619796/article/details/114533877
Recommended