$nextTick ref作用
$nextTick的作用是,更新dom是异步操作,而此函数实在dom渲染完成之后执行写法
第一种写法:
this.$nextTick(()=>{
})第二种写法:
Vue.nextTick(()=>{
})ref是以属性的方式给组件注册,用来获取dom节点,如果该属性在子组件上,则获取到的是组件实例
this.$refs
第一种写法:
this.$nextTick(()=>{
})第二种写法:
Vue.nextTick(()=>{
})this.$refs
相关推荐