这篇文章主要介绍了iview-admin中在table中使用Tooltip提示效果。
1. table中文字溢出隐藏,提示气泡展示所有信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| jLongText(item){ item.render = (h, params)=>{ let txt = params.row[params.column.key] let tableTxt = null if(txt){ if(txt.length > item.longText){ tableTxt = txt.substring(0, item.longText) + '.....' }else{ tableTxt = txt } } return h('Tooltip', { props: { placement: 'top' } },[ tableTxt, h('span', {slot: 'content', style: {whiteSpace: 'normal', wordBreak: 'break-all'}}, txt) ]) } return item },
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| { title: '状态监控', align: 'center', key: 'stat' render: (h, params) => { return h('Tooltip', { props: { placement: "right" } },[ stat, [ h('p', { slot: 'content'},'CPU:11.1%'), h('p', { slot: 'content'},'内存:5/12GB') ] ]); } }
|
1 2 3 4 5
| <Tooltip :disabled="!msg"> <div slot="content" style="white-space:normal">{{msg}}</div> <Input v-model="msg" /> </Tooltip>
|