1、text组件提供一个lines的样式,直接把这个样式写在css里就可以生效了,并且带了省略号。这里的坑就是不要写在标签的属性上,而是要写在样式里。
<template>
<div class="topheader">
<text class="top_text"> 哇哇哇哇哇哇哇哇的顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶大大大</text>
</div>
</template>
<script>
export default {
}
</script>
<style scoped>
.topheader{
background-color:red;
padding:10px;
}
.top_text{
color:#fff;
text-align: center;
font-size:50px;
lines:1; //溢出隐藏
}
</style>