<div class="" style="width: 39%;">
<span class="name2" style="width:25.5%;"> 姓名</span>
<span class="value" style="width:50%;">
<span class="patientInfoDiagnosis" v-if='visitInfo.WorkingAddress.length<10'>{{visitInfo.WorkingAddress}}</span>
<el-tooltip :content="visitInfo.WorkingAddress" placement="top" v-if="visitInfo.WorkingAddress.length>=10">
<span class="patientInfoDiagnosis2">{{visitInfo.WorkingAddress+'...'}}</span>
</el-tooltip>
</span>
</div>
.patientInfoDiagnosis .patientInfoDiagnosis2{
font-size: 14px;font-family: PingFang SC;font-weight: 400;color: #333333;
}
.patientInfoDiagnosis2{
width:70%;
line-height: 12px;
display: inline-block;
overflow: hidden; text-overflow:ellipsis; white-space: nowrap;
}
.patientInfoDiagnosis2:hover{
// color: #0055C3;cursor: pointer;
}
2021年11月25号更新,
因为滑过显示的文字太多,会整屏显示,要控制宽度
我是粗暴的写在全局的app.vue里面的
.el-tooltip__popper.is-dark{
width: 50%;
}
2022年4月27号 更新
在表格中处理字数比较多的情况
注意:class样式部分是要上面的css代码哦
```javascript
<template slot-scope="scope">
<span
class="patientInfoDiagnosis"
v-if="scope.row.PresentHistory.length < 15"
>{{ scope.row.PresentHistory }}</span
>
<el-tooltip placement="top" v-else>
<template slot="content">
<p style="max-width: 500px">{{ scope.row.PresentHistory }}</p>
</template>
<div class="patientInfoDiagnosis2">
{{ scope.row.PresentHistory + "..." }}
</div>
</el-tooltip>
</template>
23年12月13号更新,
以上是el-elment的组件
以下用原生来写超出出现…, 滑过显示全部。
<span class="ItemName2" :title="GetBigPatientsInfo.PatientName">{{GetBigPatientsInfo.PatientName ? GetBigPatientsInfo.PatientName : empty}}</span>
.ItemName2{
display: inline-block;
width: 76%;
height: 36px;
background: #F0F3FF;
border-radius: 4px;
color: #333333;
text-indent: 1em;
overflow: hidden;
vertical-align: top;
text-overflow: ellipsis;
white-space: nowrap;
}