el-popover el-table 坑

297 阅读1分钟

项目场景:

element 2.15.0

问题描述:

el-popover content属性的 slot 怎么使用? el-table 怎么合并行或者列

解决方案:

1.el-popover

目前经过尝试的方法
1.<slot></slot> !!!不要加content
<slot>
	testData
</slot>

2.<div  class="popover-content">{{testData}}</div>

2.el-table 怎么合并列或行

span-method 是官方文档给出的合并方法 使用步骤如下(以合并列为例)
1.  <el-table :data="tableData" :span-method="spanmethod"> //template
2.  <span  v-if="scope.$index===0">testCol</span> // scope.$index===0 表示第一个span为testCol
3.  spanmethod(info) { // method
      if (info.columnIndex === 7) {
        console.log(info)
        if (info.rowIndex === 0) {
          return { rowspan: 5, colspan: 1 }
		}
	}
	方法传回 info 参数 其中包括 row column rowIndex columnIndex 
	info.columnIndex === 7 表示 第8列 进行合并
	info.rowIndex===0 表示从第1行开始
	rowspan 表示合并几行 
	colspan 表示合并几列