出现原因 在method和mounted中使用,页面还未加载好,所以出现undefined 解决 在外层包一层$nextTick,例如: this.$nextTick(() => { console.log(this.$refs['input']); })