vue ref获取实例子undefined

80 阅读1分钟

当你再created中使用 this.$refs时 dom没有加载成功 所以为undefined

所以你要是想获取

1、要么写在mounted中 dom已经加载完成

2、使用this.$nextTick(function(){})