<el-col :span="7" ref="wrap"><div></div></el-col>
mounted () { let height =document.body.clientHeight
console.log(height)
console.log(this.$refs.wrap)
// this.$refs.wrap.style.height = height
}輸出的this.$refs.wrap,并不是一個dom,不知是哪里出了問題?
2 回答

智慧大石
TA貢獻1946條經驗 獲得超3個贊
$refs.wrap 拿到的是一個VUE組件,并不是一個DOM。
如果想要手動操作DOM,在組件內給節點一個ID,比如el-col上給一個ID,然后用this.$el.querySelector(#ID)拿到來進行操作。
添加回答
舉報
0/150
提交
取消