fantasia-ui 0.0.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,3 +33,101 @@ export default {
33
33
  <FUpload crop mosaic @upload="handleUplaod" />
34
34
  </template>
35
35
  ```
36
+
37
+ ### Table 组件
38
+
39
+ ```vue
40
+ <script lang="ts">
41
+ import { FTable } from 'fantasia-ui';
42
+ import type { Actions, Columns } from 'fantasia-ui';
43
+ import { ElEmpty } from 'element-plus';
44
+
45
+ interface Data {
46
+ id: number;
47
+ nickname: string;
48
+ }
49
+
50
+ export default {
51
+ components: {
52
+ FTable
53
+ },
54
+ data: {
55
+ columns: [
56
+ {
57
+ prop: 'id',
58
+ label: 'ID',
59
+ sortable: true
60
+ },
61
+ {
62
+ prop: 'nickname',
63
+ label: '昵称',
64
+ },
65
+ {
66
+ prop: 'username',
67
+ label: '用户名',
68
+ align: 'center',
69
+ filters: [
70
+ {
71
+ text: '测试',
72
+ value: '测试'
73
+ }
74
+ ]
75
+ }
76
+ ],
77
+ actions: [
78
+ {
79
+ action: 'button',
80
+ label: '删除',
81
+ event: 'delete',
82
+ type: 'danger'
83
+ },
84
+ {
85
+ action: 'button',
86
+ label: '删除',
87
+ event: 'delete',
88
+ type: 'danger'
89
+ },
90
+ {
91
+ action: 'button',
92
+ label: '删除',
93
+ event: 'delete',
94
+ type: 'danger'
95
+ },
96
+ ],
97
+ data: [
98
+ {
99
+ id: 1,
100
+ nickname: '测试'
101
+ }
102
+ ]
103
+ },
104
+ methods: {
105
+ handleAction: (row: Data, event: string) => {
106
+ switch (event) {
107
+ case 'delete':
108
+ ElMessageBox.confirm(
109
+ '确认删除?',
110
+ '警告',
111
+ {
112
+ confirmButtonText: '确定',
113
+ cancelButtonText: '取消',
114
+ type: 'warning',
115
+ }
116
+ )
117
+ break;
118
+ default:
119
+ return
120
+ }
121
+ }
122
+ }
123
+ }
124
+ </script>
125
+
126
+ <template>
127
+ <FTable :columns="columns" :data="data" :actions="actions" @action="handleAction" border>
128
+ <template #empty>
129
+ <ElEmpty description="暂无数据" />
130
+ </template>
131
+ </FTable>
132
+ </template>
133
+ ```