|
| 1 | +:::anchor Long text destroys layout |
| 2 | + |
| 3 | +:::demo 1、Too much text in a cell destroys the layout,This can be controlled by style [word-break](https://developer.mozilla.org/zh-CN/docs/Web/CSS/word-break) <br>2、You can also use it with [Cell Ellipsis](#/zh/doc/table/cell-ellipsis) |
| 4 | + |
| 5 | +```html |
| 6 | +<template> |
| 7 | + <div> |
| 8 | + word-break: |
| 9 | + <el-radio-group size="small" v-model="wordBreak"> |
| 10 | + <el-radio-button label="normal">normal</el-radio-button> |
| 11 | + <el-radio-button label="keep-all">keep-all</el-radio-button> |
| 12 | + <el-radio-button label="break-all">break-all</el-radio-button> |
| 13 | + <el-radio-button label="break-word">break-word</el-radio-button> |
| 14 | + </el-radio-group> |
| 15 | + <br /><br /> |
| 16 | + <ve-table |
| 17 | + :style="{'word-break':wordBreak}" |
| 18 | + :columns="columns" |
| 19 | + :table-data="tableData" |
| 20 | + :border-around="true" |
| 21 | + :border-x="true" |
| 22 | + :border-y="true" |
| 23 | + /> |
| 24 | + </div> |
| 25 | +</template> |
| 26 | + |
| 27 | +<script> |
| 28 | + export default { |
| 29 | + data() { |
| 30 | + return { |
| 31 | + wordBreak: "normal", |
| 32 | + columns: [ |
| 33 | + { field: "name", key: "a", title: "Name 40%", width: "40%" }, |
| 34 | + { field: "date", key: "b", title: "Tel 20%", width: "20%" }, |
| 35 | + { |
| 36 | + field: "hobby", |
| 37 | + key: "c", |
| 38 | + title: "Hobby 20%", |
| 39 | + width: "20%", |
| 40 | + /* ellipsis: { |
| 41 | + showTitle: true, |
| 42 | + lineClamp: 5, |
| 43 | + }, */ |
| 44 | + }, |
| 45 | + { field: "address", key: "d", title: "Address 20%", width: "20%" }, |
| 46 | + ], |
| 47 | + tableData: [ |
| 48 | + { |
| 49 | + name: "John", |
| 50 | + date: "1900-05-20", |
| 51 | + hobby: |
| 52 | + "Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu 大江东去浪淘尽千古风流人物故垒西边人道是三国周郎赤壁乱石穿空惊涛拍岸卷起千堆雪江山如画一时多少豪杰", |
| 53 | + address: "No.1 Century Avenue, Xiamen", |
| 54 | + }, |
| 55 | + { |
| 56 | + name: "Dickerson", |
| 57 | + date: "1910-06-20", |
| 58 | + hobby: "coding and coding repeat", |
| 59 | + address: "No.1 Century Avenue, Beijing", |
| 60 | + }, |
| 61 | + { |
| 62 | + name: "Larsen", |
| 63 | + date: "2000-07-20", |
| 64 | + hobby: "coding and coding repeat", |
| 65 | + address: "No.1 Century Avenue, Chongqing", |
| 66 | + }, |
| 67 | + { |
| 68 | + name: "Geneva", |
| 69 | + date: "2010-08-20", |
| 70 | + hobby: "coding and coding repeat", |
| 71 | + address: "No.1 Century Avenue, Xiamen", |
| 72 | + }, |
| 73 | + { |
| 74 | + name: "Jami", |
| 75 | + date: "2020-09-20", |
| 76 | + hobby: "coding and coding repeat", |
| 77 | + address: "No.1 Century Avenue, Shenzhen", |
| 78 | + }, |
| 79 | + ], |
| 80 | + }; |
| 81 | + }, |
| 82 | + }; |
| 83 | +</script> |
| 84 | +``` |
| 85 | + |
| 86 | +::: |
0 commit comments