vue监听dom渲染结束再触发方法 this.$nextTick

// 文件预览
    handleview(index, row) {
      console.log(index, row);
      console.log(row.zbwjurl)
      this.viewFileDialogVisible = true
//组件加载,组件可见
      

加载的组件中的dom获取不到:
打印相关信息,发现:
this. r e f s 成 功 打 印 , 且 包 含 了 a 的 信 息 , 但 是 t h i s . refs成功打印,且包含了a的信息,但是this. refsathis.refs.a打印为undifined。
我想知道,什么情况下会出现可以获取this. r e f s , 但 是 t h i s . refs, 但是this. refsthis.refs.attribute = undifined的情况:

      console.log(this.$refs)
console.log(this.$refs.fileViewIframe)  //不可以打印获取
      this.$nextTick(function() {
        console.log(this.$refs.fileViewIframe) //可以打印获取

      })
      // this.$refs.fileViewIframe.src = this.GLOBAL.host+ 'imgio/img?url='+ row.zbwjurl
    },

vue监听dom渲染结束再触发方法
watch:{
materielId:function(){//materielId为需要监听的data
this.$nextTick(function(){
//这里写方法
});
},
}

你可能感兴趣的:(web前端,vue,vue.js)