el-dialog中ref无效

在这里插入图片描述

  • 从图中可以看出el-dialog中的组件是不会提前加载的。所以使用$refs会报错。

  • 解决方案

    • 使用$nextTick
 this.$nextTick(() => {
      console.log("ref ",  this.$refs.tagTitleRef);
    })
  • 这样就能获取到了,如下图所示。
    在这里插入图片描述

posted on 2022-12-09 08:59  愤怒的苹果ext  阅读(210)  评论(0编辑  收藏  举报

导航