<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
	提交
		取消
	