用vue 获取动态元素的宽度
1.等到所有节点加载完成,要放在this.nextTick里面。∗∗∗∗2.要使用nextTick里面。** **2.要使用nextTick里面。∗∗∗∗2.要使用el挂载此元素
<el-input ref="companyStyle"></el-input>newAddBtn(){ let _this= this; this.$nextTick(function () { _this.inputStyWidth = _this.$refs.companyStyle.$el.clientWidth + 'px'; }