diff --git a/jero-web/src/components/jero/JTable.vue b/jero-web/src/components/jero/JTable.vue
index 53602629..f1d8407c 100644
--- a/jero-web/src/components/jero/JTable.vue
+++ b/jero-web/src/components/jero/JTable.vue
@@ -1,52 +1,49 @@
@@ -55,7 +52,6 @@
import { Table } from 'ant-design-vue'
export default {
- // TODO 命名和全局保持统一,应为JTable
name: 'JTable',
props: Object.assign(
{
@@ -140,14 +136,25 @@ export default {
return false
}
},
+ slots() {
+ let slots = []
+ for (let column of this.columns) {
+ if (column.scopedSlots && column.scopedSlots.customRender) {
+ slots.push(column.scopedSlots.customRender)
+ }
+ }
+ return slots
+ }
},
mounted() {
// console.log(this.aColumns)
+ // console.log(this.columns)
+ console.log(this.$attrs)
// 遍历出筛选列头的所有选项
this.columns.forEach((item) => {
let colItem = {
- value: item.slots.title,
- label: item.slots.title,
+ value: item.title,
+ label: item.title,
disabled: false,
}
this.plainOptions.push(colItem)
@@ -161,12 +168,11 @@ export default {
}
// 遍历出筛选列头中的已选项
this.aColumns.forEach((item) => {
- this.checkedList.push(item.slots.title)
+ this.checkedList.push(item.title)
})
},
methods: {
// 用户可自行筛选列头显示的字段
- // TODO 该段代码复杂,建议逻辑复杂的代码,在方法名上注释清楚大致逻辑
onChange(e) {
// 只剩一个时候,最后一个多选按钮禁用
if (this.checkedList.length === 1) {
@@ -187,7 +193,7 @@ export default {
//转换为dataIndex
for (let i = 0; i < e.length; i++) {
this.columns.find((item) => {
- if (item.slots.title === e[i]) {
+ if (item.title === e[i]) {
trfList.push(item.dataIndex)
}
})
diff --git a/jero-web/src/views/demo/list/JTableDemo.vue b/jero-web/src/views/demo/list/JTableDemo.vue
index 8dcd76f9..5e420eec 100644
--- a/jero-web/src/views/demo/list/JTableDemo.vue
+++ b/jero-web/src/views/demo/list/JTableDemo.vue
@@ -8,6 +8,11 @@
:columns="columns"
bordered
>
+
+
+ text: {{ text }}- record:{{ record }}- index:{{ index }}
+
+
@@ -95,7 +100,7 @@ export default {
],
columns: [
{
- // title: '姓名',
+ title: '姓名',
dataIndex: 'name',
key: 1,
width: 200,
@@ -108,86 +113,88 @@ export default {
fixedValue: 3,
},
// fixed: 'right'
+
},
{
- // title: '年龄',
+ title: '年龄',
dataIndex: 'age',
key: 2,
width: 200,
slots: {
- title: '年龄',
+ // title: '年龄',
fixedValue: 3,
},
- sorter: (a, b) => a.age - b.age,
+ sorter: true,
},
{
- // title: '住址',
+ title: '住址',
dataIndex: 'address',
key: 3,
width: 200,
// sorter: true,
slots: {
- title: '住址',
+ // title: '住址',
fixedValue: 3,
},
sorter: (a, b) => a.address.length - b.address.length,
},
{
- // title: '住址1',
+ title: '住址1',
dataIndex: 'address1',
key: 4,
width: 200,
slots: {
- title: '住址1',
+ // title: '住址1',
fixedValue: 3,
},
},
{
- // title: '住址2',
+ title: '住址2',
dataIndex: 'address2',
key: 5,
width: 200,
slots: {
- title: '住址2',
+ // title: '住址2',
fixedValue: 3,
},
},
{
- // title: '住址3',
+ title: '住址3',
dataIndex: 'address3',
key: 6,
width: 200,
slots: {
- title: '住址3',
+ // title: '住址3',
fixedValue: 3,
},
},
{
- // title: '住址4',
+ title: '住址4',
dataIndex: 'address4',
key: 7,
width: 200,
slots: {
- title: '住址4',
+ // title: '住址4',
fixedValue: 3,
},
},
{
- // title: '住址5',
+ title: '住址5',
dataIndex: 'address5',
key: 8,
width: 500,
slots: {
- title: '住址5',
+ // title: '住址5',
fixedValue: 3,
},
},
{
+ title: '操作',
dataIndex: 'address6',
key: 9,
width: 500,
slots: {
- title: '操作',
+ // title: '操作',
fixedValue: 3,
},
scopedSlots: { customRender: 'action' },