let txtDom = this.$refs.textContainer;
for (let i = 0; i < txtDom.length; i++) {
let curHeight = txtDom[i].offsetHeight;
if (curHeight > twoHeight) {
this.$set(
this.historyList,
i,
Object.assign({}, this.historyList[i], { status: true })
);
} else {
this.$set(
this.historyList,
i,
Object.assign({}, this.historyList[i], { status: null })
);
}
}
},
more(index) {
this.historyList[index].status = !this.historyList[index].status;
},
},
};
less、vue-cli3.0
占位不可删除
class=“text2”
ref=“textContainer2”
:class=“{ retract2: testObj }”
:style=“{ ‘max-height’: testObj ? textHeight2 : ‘’ }”
{{ name }}
<span v-if=“testObj” class=“link2” @click=“moreBtn()”>