0
点赞
收藏
分享

微信扫一扫

MySQL的索引、事务、锁、调优

龙毓七七 2024-07-24 阅读 8

问题:

onMounted(() => {
  nextTick(()=>{
    console.log(treeselectRef, 'treeselectRef.value');
    console.log(treeselectRef.value, 'treeselectRef.value');
  });
});

输出:

查看绑定和定义都没有问题,还是获取不到

解决:使用getCurrentInstance去访问$refs里的方法

具体操作如下:(查询以后发现原先的ctx在线上会出现问题,需要使用proxy代替ctx)

<script setup>
import { getCurrentInstance } from 'vue';

const {proxy}=getCurrentInstance()

function getBaseTime() {

    proxy.$refs.treeselectRef.clear()
    
  }
}
</script>
举报

相关推荐

0 条评论