ant design初尝试遇到的问题---table插槽以及title不识别<br/>的问题

       <template
            slot="reason"
            slot-scope="text"
          >
            <div class="reasonText"
                 :title="(text+'').replace(/<br \/>/g, '\r\n')"    // title只识别\r\n换行
                 v-html="text"
            />
          </template>

  

// 表格的Columns

{ title: '原因', dataIndex: 'reason', ellipsis: true, scopedSlots: { customRender: 'reason' }, width: '500px' },
        {
          title: '名称',
          dataIndex: 'name',
          key: 'name',
          customRender: (text, record, index) => {
            return (
              <span
                class="text-active pointer"
                onclick={() => this.toDetail(record)}
              >
                {{ text }}
              </span>
            )
          }
        },

  

// 超过4行显示省略号
.reasonText{ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }

  

posted on 2022-06-14 16:19  稳住别慌  阅读(774)  评论(0编辑  收藏  举报