File tree Expand file tree Collapse file tree 7 files changed +53
-18
lines changed Expand file tree Collapse file tree 7 files changed +53
-18
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ declare module 'vue' {
45
45
ElSwitch : typeof import ( 'element-plus/es' ) [ 'ElSwitch' ]
46
46
ElTable : typeof import ( 'element-plus/es' ) [ 'ElTable' ]
47
47
ElTableColumn : typeof import ( 'element-plus/es' ) [ 'ElTableColumn' ]
48
+ ElTag : typeof import ( 'element-plus/es' ) [ 'ElTag' ]
48
49
ElTooltip : typeof import ( 'element-plus/es' ) [ 'ElTooltip' ]
49
50
ElTree : typeof import ( 'element-plus/es' ) [ 'ElTree' ]
50
51
Form : typeof import ( './src/components/ProTable/components/form.vue' ) [ 'default' ]
@@ -63,4 +64,7 @@ declare module 'vue' {
63
64
SearchForm : typeof import ( './src/components/ProTable/components/searchForm.vue' ) [ 'default' ]
64
65
SidebarItemLink : typeof import ( './src/layout/components/layout-menu/SidebarItemLink.vue' ) [ 'default' ]
65
66
}
67
+ export interface ComponentCustomProperties {
68
+ vLoading : typeof import ( 'element-plus/es' ) [ 'ElLoadingDirective' ]
69
+ }
66
70
}
Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ export default [
68
68
'@typescript-eslint/no-unused-vars' : [ 'warn' ] , // 设置为 warning
69
69
'@typescript-eslint/no-explicit-any' : 'warn' , // 允许使用 any
70
70
'@typescript-eslint/no-empty-object-type' : 'off' , // {} 类型而不触发错误
71
- '@typescript-eslint/no-unused-expressions' : "warn" // 未使用的表达式
71
+ '@typescript-eslint/no-unused-expressions' : "warn" , // 未使用的表达式,
72
+ 'no-undef' : 'off' , // 禁用 no-undef 规则
72
73
} ,
73
74
} ,
74
75
prettierRecommended , // 覆盖掉eslint的规范
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { ElTable, ElTableColumn } from 'element-plus'
3
3
// import { useTable } from '@/hooks/useTable'
4
4
import notDataImage from '@/assets/images/notData.png' // 采用 import 语法引入图片
5
5
import { ColumnProps , RenderScope } from '../model'
6
- // const { handleSizeChange, handleCurrentChange } = useTable()
6
+
7
7
export default defineComponent ( {
8
8
props : {
9
9
columns : {
Original file line number Diff line number Diff line change 11
11
:columns =" searchColumns"
12
12
:search-param =" searchParam"
13
13
></SearchForm >
14
- xx{{ searchParam }}
15
14
16
- <!-- :columns="searchColumns" -->
17
- <TableColumn v-bind =" props" :data =" processTableData" ></TableColumn >
15
+ <TableColumn
16
+ v-bind =" props"
17
+ :data =" processTableData"
18
+ v-loading =" !processTableData || !processTableData.length"
19
+ ></TableColumn >
20
+
18
21
<Pagination
19
22
v-if =" pagination"
20
23
:pageable =" pageable"
Original file line number Diff line number Diff line change @@ -93,8 +93,10 @@ export const useTable = (
93
93
...state . totalParam
94
94
} )
95
95
console . log ( 'data' , data )
96
- dataCallBack && ( data = dataCallBack ( data ) )
97
- state . tableData = isPageable ? data . list : data
96
+ setTimeout ( ( ) => {
97
+ dataCallBack && ( data = dataCallBack ( data ) )
98
+ state . tableData = isPageable ? data . list : data
99
+ } , 1000 )
98
100
99
101
// 解构后台返回的分页数据 (如果有分页更新分页信息)
100
102
if ( isPageable ) {
Original file line number Diff line number Diff line change 84
84
// 解决表格数据为空时样式不居中问题(仅在element-plus中)
85
85
.el-table__empty-block {
86
86
.el-table__empty-text {
87
+ width : auto ;
87
88
height : 300px ;
88
89
display : flex ;
89
90
Original file line number Diff line number Diff line change 1
1
<template >
2
- <!-- <proTable :table-columns="tableColumns" :data="fetchData" stripe /> -->
3
2
<div class =" table-box" >
4
3
<ProTable
5
4
ref =" proTable"
9
8
:request-api =" getUserList"
10
9
></ProTable >
11
10
</div >
12
- <!-- :row-class-name="tableRowClassName"
13
- :span-method="objectSpanMethod"
14
- :show-summary="true"
15
- :summary-method="getSummaries"
16
- @row-click="rowClick" -->
11
+
17
12
<el-button @click =" focusHandler" >聚焦</el-button >
18
13
<my-input v-model =" msg" ref =" myInputRef" >
19
14
<template #prepend >Prepend</template >
@@ -38,7 +33,10 @@ const tableColumns = ref([
38
33
label: '名称',
39
34
prop: 'username',
40
35
width: '150',
41
- dataIndex: 'username'
36
+ dataIndex: 'username',
37
+ render: (row) => {
38
+ return <el-tag type="primary">{row.username} </el-tag>
39
+ }
42
40
},
43
41
{
44
42
label: '描述',
@@ -47,7 +45,19 @@ const tableColumns = ref([
47
45
{
48
46
label: '手机',
49
47
prop: 'mobile',
50
- dataIndex: 'mobile'
48
+ dataIndex: 'mobile',
49
+ render: (row) => {
50
+ return (
51
+ <>
52
+ {row.mobile ? (
53
+ <el-icon>
54
+ <Cellphone />
55
+ </el-icon>
56
+ ) : null}{' '}
57
+ {row.mobile}
58
+ </>
59
+ )
60
+ }
51
61
},
52
62
{
53
63
label: '状态',
@@ -64,12 +74,26 @@ const tableColumns = ref([
64
74
{
65
75
label: '操作',
66
76
prop: 'action',
67
- width: '180 ',
77
+ width: '280 ',
68
78
render: (row) => {
69
79
const handleAction = (row) => {
70
- console.log(row)
80
+ console.log(
81
+ '%c [ row ]-71',
82
+ 'font-size:13px; background:pink; color:#bf2c9f;',
83
+ row
84
+ )
71
85
}
72
- return <el-button onClick={() => handleAction(row)}>操作按钮 </el-button>
86
+ return (
87
+ <>
88
+ <el-button type="primary" onClick={() => handleAction(row)}>
89
+ 新增
90
+ </el-button>
91
+ <el-button onClick={() => handleAction(row)}>编辑 </el-button>
92
+ <el-button type="danger" onClick={() => handleAction(row)}>
93
+ 删除
94
+ </el-button>
95
+ </>
96
+ )
73
97
}
74
98
}
75
99
])
You can’t perform that action at this time.
0 commit comments