vue中字符串文本长度超出显示省略号...及悬浮显示全部文本

675 阅读1分钟
<el-form-item :label="$t('operationStockInAccept.reasonForReturn') + ':'">
  <span class="spanStyle" :title="warehousingEntry.enterReason">{{warehousingEntry.enterReason}}</span>
</el-form-item>


 .spanStyle {
  display: inline-block;
  white-space: normal;
  width: 100px;
  overflow: hidden; /*超出的文本隐藏*/
  text-overflow: ellipsis; /* 溢出用省略号*/

}



.spanStyle {
  display: inline-block;
  white-space: normal;
  width: 100px;
  overflow: hidden; /*超出的文本隐藏*/
  text-overflow: ellipsis; /* 溢出用省略号*/

}

      <p class="col-md-11">
        <span>名称: </span>
        <span id="fireHydrantName" :title="item.devicename">{{ item.devicename }}</span>
      </p>

          #fireHydrantName {
                  white-space: nowrap;
                  overflow: hidden;
                  text-overflow: ellipsis;
                        }