element中動態Tooltip 內容過長


<el-table-column label="評價內容" style="width: 30%;" :show-overflow-tooltip="true">
   <template slot-scope="scope">
      {{ scope.row.content || "-" }}
       <el-tooltip
          :content="scope.row.content"
          placement="top">
       </el-tooltip>
   </template>
</el-table-column>

第一種就是使用 el-tooltip 加上 :show-overflow-tooltip="true" (超出表格長度會自動省略)進行實現,但是這種 tooltip 內容還是過長 還超出了屏幕范圍

 

<el-table-column label="評價內容" style="width: 30%;">
   <template slot-scope="scope">
      <el-popover placement="top-start" title="評價內容" width="500" trigger="hover" >
         <div>{{scope.row.content}}</div>
         <span slot="reference">{{ scope.row.content.substr(0,30)+'...' }}</span>
      </el-popover>
   </template>
</el-table-column>

第二種,用 el-popover,substr 限制提示內容 一行的字數,width 可自行調節,trigger 移入事件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM