码迷,mamicode.com
首页 > 其他好文 > 详细

iview Tooltip换行及应用

时间:2018-09-14 17:28:57      阅读:628      评论:0      收藏:0      [点我收藏+]

标签:length   use   hit   inter   应用   nbsp   substring   string   The   

第一种:

<Tooltip placement="bottom">
    <Button>Multiple lines</Button>
    <div slot="content" style="white-space: normal;">
       A balloon appears when the mouse passes over this text
     </div>
</Tooltip>

第二种: 

render: (h, params) => {
            let texts = ‘‘; //表格列显示文字
            if (params.row.content !== null) {
              if (params.row.content.length > 6) { //进行截取列显示字数
                texts = params.row.content.substring(0, 6) + ".....";
              } else {
                texts = params.row.content;
              }
            }
            return h(‘div‘, [
              h(‘Tooltip‘, {
                props: {
                  placement: ‘bottom‘,
                  // transfer: true  //是否将弹层放置于 body 内
                },
                style: {
                  cursor: ‘pointer‘,
                }
              }, [ //这个中括号表示是Tooltip标签的子标签
                texts, //表格列显示文字
                h(‘div‘, {
                    slot: ‘content‘,
                    style: {
                      whiteSpace: ‘normal‘
                    }
                  }, params.row.content //整个的信息即气泡内文字
                )
              ])
            ]);
          }

显示结果如下:

技术分享图片

  

 

iview Tooltip换行及应用

标签:length   use   hit   inter   应用   nbsp   substring   string   The   

原文地址:https://www.cnblogs.com/zhaojunhao/p/9647461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!