超清爽博客
如果直接用ref获取组件,则只能得到vue组件,所以使用$el属性就可以选取DOM
模板上定义ref
123
<template> <test ref="test"></test></template>
JS用ref获取,然后用$el选择
1
console.log(this.$refs.test.$el)