vue-super-crud 1.7.1 → 1.7.2
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 +42 -10
- package/lib/index.css +1 -1
- package/lib/super-crud.min.js +2 -2
- package/package.json +21 -16
- package/.browserslistrc +0 -3
- package/.versionrc.json +0 -36
- package/CHANGELOG.md +0 -232
- package/babel.config.js +0 -12
- package/build/alias.js +0 -10
- package/build/build.js +0 -52
- package/build/config.js +0 -70
- package/deploy.bat +0 -14
- package/docs/.vuepress/components/button/base.vue +0 -88
- package/docs/.vuepress/components/common/code-format.vue +0 -331
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +0 -68
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +0 -73
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +0 -160
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +0 -49
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +0 -91
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +0 -63
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +0 -98
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +0 -72
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +0 -107
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/baseUse/height.vue +0 -82
- package/docs/.vuepress/components/crud/baseUse/index.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/loading.vue +0 -70
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +0 -108
- package/docs/.vuepress/components/crud/baseUse/selection.vue +0 -114
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +0 -118
- package/docs/.vuepress/components/crud/baseUse/title.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/buttons/common.vue +0 -115
- package/docs/.vuepress/components/crud/buttons/fast.vue +0 -82
- package/docs/.vuepress/components/crud/contextMenu/base.vue +0 -72
- package/docs/.vuepress/components/crud/copy.vue +0 -52
- package/docs/.vuepress/components/crud/crudEvents/api.vue +0 -157
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +0 -93
- package/docs/.vuepress/components/crud/crudEvents/events.vue +0 -188
- package/docs/.vuepress/components/crud/dataSort/base.vue +0 -142
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +0 -53
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +0 -111
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +0 -68
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/renderType/1.vue +0 -57
- package/docs/.vuepress/components/crud/renderType/2.vue +0 -63
- package/docs/.vuepress/components/crud/renderType/3.vue +0 -105
- package/docs/.vuepress/components/crud/renderType/5.vue +0 -91
- package/docs/.vuepress/components/crud/search/1.vue +0 -90
- package/docs/.vuepress/components/crud/search/2.vue +0 -78
- package/docs/.vuepress/components/crud/search/3.vue +0 -107
- package/docs/.vuepress/components/crud/search/base.vue +0 -123
- package/docs/.vuepress/components/crud/search/localSearch.vue +0 -124
- package/docs/.vuepress/components/crud/search/special.vue +0 -148
- package/docs/.vuepress/components/crud/selection/events.vue +0 -47
- package/docs/.vuepress/components/crud/selection/pagination.vue +0 -94
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +0 -64
- package/docs/.vuepress/components/crud/span/base.vue +0 -69
- package/docs/.vuepress/components/crud/span/special.vue +0 -75
- package/docs/.vuepress/components/crud/summary/base.vue +0 -99
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +0 -174
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +0 -194
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +0 -219
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +0 -172
- package/docs/.vuepress/components/crud/tableEdit/free.vue +0 -88
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +0 -82
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +0 -154
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +0 -107
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +0 -116
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +0 -98
- package/docs/.vuepress/components/crud/validate/base.vue +0 -122
- package/docs/.vuepress/components/crud/validate/custom.vue +0 -82
- package/docs/.vuepress/components/crud/validate/regulars.vue +0 -88
- package/docs/.vuepress/components/crud/validate/relation.vue +0 -91
- package/docs/.vuepress/components/crud/validate/tree.vue +0 -82
- package/docs/.vuepress/components/dialog/baseUse/base.vue +0 -92
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +0 -78
- package/docs/.vuepress/components/dialog/baseUse/control.vue +0 -79
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +0 -59
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +0 -87
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +0 -79
- package/docs/.vuepress/components/dict/DictLinkage.vue +0 -91
- package/docs/.vuepress/components/dict/baseUse.vue +0 -72
- package/docs/.vuepress/components/dict/component.vue +0 -82
- package/docs/.vuepress/components/dict/localDict.vue +0 -68
- package/docs/.vuepress/components/form/baseUse/base.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +0 -92
- package/docs/.vuepress/components/form/baseUse/deep.vue +0 -57
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +0 -47
- package/docs/.vuepress/components/form/baseUse/group.vue +0 -66
- package/docs/.vuepress/components/form/baseUse/hidden.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/label.vue +0 -51
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/validate.vue +0 -52
- package/docs/.vuepress/components/form/detail/base.vue +0 -78
- package/docs/.vuepress/components/form/detail/border.vue +0 -90
- package/docs/.vuepress/components/form/detail/singleDetail.vue +0 -72
- package/docs/.vuepress/components/formatData/baseUse.vue +0 -131
- package/docs/.vuepress/components/mock/index.js +0 -347
- package/docs/.vuepress/components/mockData/custom.vue +0 -69
- package/docs/.vuepress/components/mockData/example.vue +0 -290
- package/docs/.vuepress/components/positionSlot/base.vue +0 -24
- package/docs/.vuepress/components/positionSlot/form.vue +0 -71
- package/docs/.vuepress/components/positionSlot/table.vue +0 -85
- package/docs/.vuepress/components/tabs/base.vue +0 -57
- package/docs/.vuepress/components/temp.js +0 -195
- package/docs/.vuepress/config.js +0 -146
- package/docs/.vuepress/enhanceApp.js +0 -142
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +0 -25
- package/docs/.vuepress/styles/palette.styl +0 -6
- package/docs/README.md +0 -14
- package/docs/guide/button/base.md +0 -31
- package/docs/guide/commonConfig/jsx.md +0 -166
- package/docs/guide/commonConfig/presetCodeTemplate.md +0 -68
- package/docs/guide/commonConfig/renderType.md +0 -181
- package/docs/guide/crud/baseUse.md +0 -120
- package/docs/guide/crud/buttons.md +0 -18
- package/docs/guide/crud/config.md +0 -217
- package/docs/guide/crud/contextMenu.md +0 -18
- package/docs/guide/crud/dataSort.md +0 -66
- package/docs/guide/crud/genDynamicColumns.md +0 -145
- package/docs/guide/crud/handleBar.md +0 -26
- package/docs/guide/crud/renderType.md +0 -4
- package/docs/guide/crud/search.md +0 -150
- package/docs/guide/crud/selection.md +0 -73
- package/docs/guide/crud/span.md +0 -98
- package/docs/guide/crud/summary.md +0 -167
- package/docs/guide/crud/tableEdit.md +0 -377
- package/docs/guide/crud/validate.md +0 -158
- package/docs/guide/dialog/baseUse.md +0 -81
- package/docs/guide/dict/baseUse.md +0 -174
- package/docs/guide/dict/component.md +0 -88
- package/docs/guide/dict/config.md +0 -44
- package/docs/guide/form/baseUse.md +0 -142
- package/docs/guide/form/detail.md +0 -38
- package/docs/guide/formatData/baseUse.md +0 -98
- package/docs/guide/formatData/config.md +0 -142
- package/docs/guide/mockData/base.md +0 -26
- package/docs/guide/positionSlot/base.md +0 -41
- package/docs/guide/question/base.md +0 -44
- package/docs/guide/start/base.md +0 -30
- package/docs/guide/tabs/base.md +0 -63
- package/examples/App.vue +0 -52
- package/examples/Layout/components/AppMain.vue +0 -40
- package/examples/Layout/components/Item.vue +0 -29
- package/examples/Layout/components/Link.vue +0 -44
- package/examples/Layout/components/SidebarItem.vue +0 -93
- package/examples/Layout/index.vue +0 -69
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +0 -18
- package/examples/main.js +0 -54
- package/examples/router/index.js +0 -140
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +0 -63
- package/examples/styles/sidebar.scss +0 -226
- package/examples/styles/transition.scss +0 -48
- package/examples/styles/variables.scss +0 -25
- package/examples/views/crud/base.vue +0 -68
- package/examples/views/crud/handleRow.vue +0 -84
- package/examples/views/crud/search.vue +0 -116
- package/examples/views/dashboard/index.vue +0 -244
- package/examples/views/dashboard/index1.vue +0 -234
- package/examples/views/dashboard/test.vue +0 -9
- package/examples/views/formTest/index.vue +0 -168
- package/examples/views/nested/menu1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-3/index.vue +0 -5
- package/examples/views/nested/menu2/index.vue +0 -5
- package/gulpfile.js +0 -84
- package/packages/button/index.vue +0 -189
- package/packages/core/components/comp.vue +0 -223
- package/packages/core/components/position.vue +0 -135
- package/packages/core/components/render.vue +0 -460
- package/packages/core/configManager.js +0 -302
- package/packages/core/create.js +0 -8
- package/packages/core/defaultRender.js +0 -64
- package/packages/core/dict/global.js +0 -10
- package/packages/core/dict/index.js +0 -432
- package/packages/core/dict/mixin.js +0 -94
- package/packages/core/event.js +0 -60
- package/packages/core/index.js +0 -6
- package/packages/core/init.js +0 -122
- package/packages/core/mock/genConfig.js +0 -228
- package/packages/core/mock/genData.js +0 -422
- package/packages/core/mock/index.js +0 -4
- package/packages/core/rules.js +0 -111
- package/packages/crud/column.vue +0 -205
- package/packages/crud/columnAction.vue +0 -207
- package/packages/crud/columnCell.vue +0 -146
- package/packages/crud/defaultColumn.vue +0 -130
- package/packages/crud/drawerColumn.vue +0 -225
- package/packages/crud/form.vue +0 -69
- package/packages/crud/index.vue +0 -564
- package/packages/crud/menuBar.vue +0 -298
- package/packages/crud/mixins/cacheHandler.js +0 -36
- package/packages/crud/mixins/calcColumnWidth.js +0 -79
- package/packages/crud/mixins/calcHeight.js +0 -105
- package/packages/crud/mixins/columnHandler.js +0 -128
- package/packages/crud/mixins/contextMenu.js +0 -98
- package/packages/crud/mixins/dataProcessor.js +0 -202
- package/packages/crud/mixins/dialog.js +0 -109
- package/packages/crud/mixins/excelHandler.js +0 -150
- package/packages/crud/mixins/exposeMethods.js +0 -107
- package/packages/crud/mixins/generateDynamicColumns.js +0 -250
- package/packages/crud/mixins/props.js +0 -38
- package/packages/crud/mixins/searchHandler.js +0 -151
- package/packages/crud/mixins/select.js +0 -359
- package/packages/crud/mixins/spanMethod.js +0 -288
- package/packages/crud/mixins/summary.js +0 -177
- package/packages/crud/mixins/tableEdit.js +0 -547
- package/packages/crud/mixins/validate.js +0 -219
- package/packages/crud/pagination.vue +0 -110
- package/packages/crud/search.vue +0 -119
- package/packages/crud/searchHeader.vue +0 -231
- package/packages/crud/selectBanner.vue +0 -138
- package/packages/crud/utils/EditState.js +0 -319
- package/packages/crud/utils/excelExport.js +0 -112
- package/packages/crud/utils/excelImport.js +0 -112
- package/packages/crud/utils/index.js +0 -98
- package/packages/dialog/dialog.js +0 -233
- package/packages/dialog/dialog.vue +0 -15
- package/packages/dialog/index.js +0 -22
- package/packages/dict/cascadeFormat.vue +0 -179
- package/packages/dict/dateFormat.vue +0 -40
- package/packages/dict/form/cascade.vue +0 -61
- package/packages/dict/form/checkbox.vue +0 -90
- package/packages/dict/form/extendMethod.js +0 -22
- package/packages/dict/form/input-base.js +0 -31
- package/packages/dict/form/input.js +0 -20
- package/packages/dict/form/radio.vue +0 -69
- package/packages/dict/form/select.vue +0 -118
- package/packages/dict/form/switch.vue +0 -75
- package/packages/dict/valueFormat.vue +0 -188
- package/packages/directive/dialog/drag.js +0 -86
- package/packages/directive/dialog/dragSize.js +0 -42
- package/packages/directive/index.js +0 -9
- package/packages/directive/insertSlot.js +0 -10
- package/packages/form/contextMenu.js +0 -192
- package/packages/form/draftDrawer.vue +0 -391
- package/packages/form/formAction.vue +0 -97
- package/packages/form/formItem.vue +0 -259
- package/packages/form/index.vue +0 -451
- package/packages/form/props.js +0 -15
- package/packages/grid/cell.vue +0 -65
- package/packages/grid/index.vue +0 -130
- package/packages/group/index.vue +0 -96
- package/packages/tabs/index.vue +0 -290
- package/packages/tooltip/index.js +0 -9
- package/packages/tooltip/tooltip.vue +0 -32
- package/packages/tooltip/tooltipComponent.js +0 -38
- package/packages/verifyInput/index.vue +0 -131
- package/styles/button.scss +0 -3
- package/styles/crud.scss +0 -425
- package/styles/dialog.scss +0 -95
- package/styles/form.scss +0 -532
- package/styles/group.scss +0 -78
- package/styles/index.scss +0 -94
- package/styles/tabs.scss +0 -139
- package/styles/verifyInput.scss +0 -56
- package/vue-jsx-sync.js +0 -90
- package/vue.config.js +0 -54
@@ -1,174 +0,0 @@
|
|
1
|
-
# 基本使用
|
2
|
-
|
3
|
-
## 使用字典+增强方法
|
4
|
-
|
5
|
-
默认字典与全局字典无需注册,直接使用即可 <br>
|
6
|
-
|
7
|
-
<ClientOnly>
|
8
|
-
<common-code-format>
|
9
|
-
<dict-baseUse slot="source"></dict-baseUse>
|
10
|
-
|
11
|
-
<<< @/docs/.vuepress/components/dict/baseUse.vue
|
12
|
-
</common-code-format>
|
13
|
-
</ClientOnly>
|
14
|
-
|
15
|
-
|
16
|
-
## 字典联动
|
17
|
-
|
18
|
-
<ClientOnly>
|
19
|
-
<common-code-format>
|
20
|
-
<dict-DictLinkage slot="source"></dict-DictLinkage>
|
21
|
-
|
22
|
-
<<< @/docs/.vuepress/components/dict/DictLinkage.vue
|
23
|
-
</common-code-format>
|
24
|
-
</ClientOnly>
|
25
|
-
|
26
|
-
## 局部字典+联动
|
27
|
-
|
28
|
-
字典数据不共用,需要配合现有组件使用,`local` 设置局部字典 <br>
|
29
|
-
|
30
|
-
<ClientOnly>
|
31
|
-
<common-code-format>
|
32
|
-
<dict-localDict slot="source"></dict-localDict>
|
33
|
-
|
34
|
-
<<< @/docs/.vuepress/components/dict/localDict.vue
|
35
|
-
</common-code-format>
|
36
|
-
</ClientOnly>
|
37
|
-
|
38
|
-
## 字典配合组件使用
|
39
|
-
|
40
|
-
<ClientOnly>
|
41
|
-
<common-code-format>
|
42
|
-
<dict-component slot="source"></dict-component>
|
43
|
-
|
44
|
-
<<< @/docs/.vuepress/components/dict/component.vue
|
45
|
-
</common-code-format>
|
46
|
-
</ClientOnly>
|
47
|
-
|
48
|
-
## 全局注册
|
49
|
-
|
50
|
-
```javascript
|
51
|
-
import superCrud from "src";
|
52
|
-
|
53
|
-
Vue.use(superCrud, {
|
54
|
-
// 默认字典配置项
|
55
|
-
dict: {
|
56
|
-
request: (key) => request({
|
57
|
-
url: '/dict/type/' + key,
|
58
|
-
method: 'get'
|
59
|
-
}),
|
60
|
-
value: "value",
|
61
|
-
label: "label",
|
62
|
-
color: "color",
|
63
|
-
children: "children",
|
64
|
-
},
|
65
|
-
// 注册全局字典模板
|
66
|
-
template: {
|
67
|
-
dicts: {
|
68
|
-
userStatus: {
|
69
|
-
request: () => request('/api/user/status'),
|
70
|
-
transform: (data) => {
|
71
|
-
return data.map(item => ({
|
72
|
-
label: item.name,
|
73
|
-
value: item.id
|
74
|
-
}))
|
75
|
-
}
|
76
|
-
},
|
77
|
-
userList: {
|
78
|
-
request: () => request('/api/user/list'),
|
79
|
-
}
|
80
|
-
}
|
81
|
-
},
|
82
|
-
});
|
83
|
-
```
|
84
|
-
|
85
|
-
全局注册的字典直接使用即可, 会通过 `$scDict[key]` 自动获取字典数据 <br>
|
86
|
-
|
87
|
-
`key` 为字典的注册名称:
|
88
|
-
- 匹配到名为key的`全局字典模板`
|
89
|
-
- 如果匹配不到名为key的`全局字典模板`,会自动将key作为`默认字典`请求函数的`参数`
|
90
|
-
|
91
|
-
```vue
|
92
|
-
<template>
|
93
|
-
<div>
|
94
|
-
{{ $scDict.userStatus }}
|
95
|
-
</div>
|
96
|
-
</template>
|
97
|
-
<script>
|
98
|
-
export default {
|
99
|
-
async created() {
|
100
|
-
await this.$scDict.sys_normal_disable.wait();
|
101
|
-
console.log(this.$scDict.sys_normal_disable);
|
102
|
-
},
|
103
|
-
};
|
104
|
-
</script>
|
105
|
-
```
|
106
|
-
|
107
|
-
## 字典注册
|
108
|
-
```javascript
|
109
|
-
// 方式一:直接传入请求函数
|
110
|
-
this.$scDict.register('userStatus', request('/api/user/status'))
|
111
|
-
|
112
|
-
// 方式二:传入配置对象
|
113
|
-
this.$scDict.register('userList', {
|
114
|
-
request: () => request('/api/user/list'),
|
115
|
-
immediate: true,
|
116
|
-
transform: (data) => {
|
117
|
-
return data.map(item => ({
|
118
|
-
label: item.name,
|
119
|
-
value: item.id
|
120
|
-
}))
|
121
|
-
}
|
122
|
-
})
|
123
|
-
|
124
|
-
// 方式三:本地静态数据
|
125
|
-
this.$scDict.register('gender', {
|
126
|
-
options: [
|
127
|
-
{ label: '男', value: 1 },
|
128
|
-
{ label: '女', value: 2 }
|
129
|
-
]
|
130
|
-
})
|
131
|
-
|
132
|
-
// 批量注册
|
133
|
-
this.$scDict.registerBatch({
|
134
|
-
gender: {
|
135
|
-
options: [
|
136
|
-
{ label: '男', value: 1 },
|
137
|
-
{ label: '女', value: 2 }
|
138
|
-
]
|
139
|
-
},
|
140
|
-
userStatus: () => request('/api/user/status'),
|
141
|
-
userList: () => request('/api/user/list'),
|
142
|
-
})
|
143
|
-
```
|
144
|
-
|
145
|
-
## 动态参数
|
146
|
-
|
147
|
-
```javascript
|
148
|
-
// 参数为函数形式时监听响应式数据变化
|
149
|
-
this.$scDict.register('cityList', {
|
150
|
-
request: (params) => request('/api/cities', params),
|
151
|
-
params: () => ({
|
152
|
-
provinceId: this.selectedProvince
|
153
|
-
}),
|
154
|
-
immediate: true // 会立即执行 params 函数并请求数据
|
155
|
-
})
|
156
|
-
|
157
|
-
// 手动传入参数
|
158
|
-
this.$scDict.get('cityList', { provinceId: 1 })
|
159
|
-
```
|
160
|
-
|
161
|
-
## 自定义增强方法
|
162
|
-
|
163
|
-
```javascript
|
164
|
-
this.$scDict.register('countries', {
|
165
|
-
request: mockApi.getProvinces,
|
166
|
-
enhanceDict: {
|
167
|
-
customFindLabel: (value, key, dictData, meta) =>
|
168
|
-
dictData.find((item) => item.value === value)?.label,
|
169
|
-
},
|
170
|
-
});
|
171
|
-
|
172
|
-
// 使用
|
173
|
-
this.$scDict.countries.customFindLabel(1)
|
174
|
-
```
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# 字典组件
|
2
|
-
## 展示组件
|
3
|
-
### DateFormat 日期格式化
|
4
|
-
用于格式化日期时间的展示。
|
5
|
-
|
6
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
7
|
-
| ----------- | ---------------------------------------- | ------ | ------------------- |
|
8
|
-
| value | 日期时间值,支持long、string、date等格式 | any | - |
|
9
|
-
| valueFormat | 输入格式化,不传则由dayjs自动转化 | string | - |
|
10
|
-
| format | 输出格式化 | string | YYYY-MM-DD HH:mm:ss |
|
11
|
-
### ValueFormat 值格式化
|
12
|
-
用于将值格式化为标签形式展示。
|
13
|
-
|
14
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
15
|
-
| ----------- | ------------------------------------------------------ | ------------ | ------------------------------------------- |
|
16
|
-
| value | 需要格式化的值,多选支持'1,2,3'或[1,2,3] | string/array | - |
|
17
|
-
| multiple | 是否多选 | boolean | true |
|
18
|
-
| separator | 多选值的分隔符 | string | , |
|
19
|
-
| color | 标签颜色,支持auto/primary/success/warning/danger/info | string | - |
|
20
|
-
| effect | 标签主题 | string | - |
|
21
|
-
| autoColors | 自动颜色列表 | array | ['primary', 'success', 'warning', 'danger'] |
|
22
|
-
| autoEffects | 自动主题列表 | array | ['light', 'plain'] |
|
23
|
-
| scope | 其他组件传入的参数 | object | - |
|
24
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
25
|
-
### CascadeFormat 级联数据格式化
|
26
|
-
用于格式化级联数据的展示。
|
27
|
-
|
28
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
29
|
-
| --------- | --------------------------------------------------------------- | ------------ | ------------------------------ |
|
30
|
-
| value | 级联值,单选时支持'1,2,3'或[1,2,3],多选时支持[[1,2,3],[4,5,6]] | string/array | - |
|
31
|
-
| separator | 值的分隔符 | string | , |
|
32
|
-
| multiple | 是否多选 | boolean | false |
|
33
|
-
| scope | 其他组件传入的参数 | object | - |
|
34
|
-
| options | 可选项数据源 | array | - |
|
35
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
36
|
-
## 表单组件
|
37
|
-
|
38
|
-
`el-select`,`el-cascader`,`el-checkbox-group`,`el-radio-group`,`el-switch`组件在使用`comp`进行组件渲染时已默认映射为封装的字典组件
|
39
|
-
|
40
|
-
### Select 选择器
|
41
|
-
基于el-select的字典选择器。
|
42
|
-
|
43
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
44
|
-
| --------- | -------------------------------- | --------------------------- | ------------------------------ |
|
45
|
-
| value | 选中值,多选支持'1,2,3'或[1,2,3] | number/string/boolean/array | - |
|
46
|
-
| separator | 多选值的分隔符 | string | , |
|
47
|
-
| multiple | 是否多选 | boolean | false |
|
48
|
-
| scope | 其他组件传入的参数 | object | - |
|
49
|
-
| options | 可选项数据源 | array | - |
|
50
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
51
|
-
### Switch 开关
|
52
|
-
基于el-switch的字典开关。
|
53
|
-
|
54
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
55
|
-
| ------- | ------------------ | ------ | ------------------------------ |
|
56
|
-
| value | 开关值 | any | - |
|
57
|
-
| scope | 其他组件传入的参数 | object | - |
|
58
|
-
| options | 可选项数据源 | array | - |
|
59
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
60
|
-
### Radio 单选框
|
61
|
-
基于el-radio-group的字典单选框。
|
62
|
-
|
63
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
64
|
-
| ------- | ------------------------------------------- | ------ | ------------------------------ |
|
65
|
-
| value | 选中值 | any | - |
|
66
|
-
| type | 单选框类型,可选值:el-radio/el-radio-button | string | el-radio |
|
67
|
-
| scope | 其他组件传入的参数 | object | - |
|
68
|
-
| options | 可选项数据源 | array | - |
|
69
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
70
|
-
### Checkbox 复选框
|
71
|
-
基于el-checkbox-group的字典复选框。
|
72
|
-
|
73
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
74
|
-
| --------- | ------------------------------------------------- | --------------------------- | ------------------------------ |
|
75
|
-
| value | 选中值,多选支持'1,2,3'或[1,2,3] | number/string/boolean/array | - |
|
76
|
-
| separator | 值的分隔符 | string | , |
|
77
|
-
| type | 复选框类型,可选值:el-checkbox/el-checkbox-button | string | el-checkbox |
|
78
|
-
| scope | 其他组件传入的参数 | object | - |
|
79
|
-
| options | 可选项数据源 | array | - |
|
80
|
-
| props | 配置选项 | object | {value:'value', label:'label'} |
|
81
|
-
### Cascade 级联选择器
|
82
|
-
基于el-cascader的字典级联选择器。
|
83
|
-
|
84
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
85
|
-
| ------- | -------------------------------- | ------ | ------ |
|
86
|
-
| value | 选中值,多选支持'1,2,3'或[1,2,3] | array | [] |
|
87
|
-
| scope | 其他组件传入的参数 | object | - |
|
88
|
-
| options | 可选项数据源 | array | - |
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# 配置文档
|
2
|
-
|
3
|
-
## 基础配置项
|
4
|
-
|
5
|
-
| 配置项 | 类型 | 默认值 | 说明 |
|
6
|
-
| ------------ | --------------- | -------- | ------------------------------------------ |
|
7
|
-
| request | Function | - | 字典数据请求函数(返回Promise) |
|
8
|
-
| label | String | label | 标签字段名 |
|
9
|
-
| value | String | value | 值字段名 |
|
10
|
-
| color | String | color | 颜色字段名 |
|
11
|
-
| children | String | children | 子节点字段名 |
|
12
|
-
| params | Object/Function | - | 请求参数,支持函数形式监听响应式数据变化 |
|
13
|
-
| immediate | Boolean | false | 是否立即加载,默认为懒加载,即使用时才加载 |
|
14
|
-
| cache | Boolean | true | 是否启用缓存 |
|
15
|
-
| dataPath | String | data | 字典数组的路径 |
|
16
|
-
| transform | Function | - | 数据转换函数 |
|
17
|
-
| otherPath | String/Array | - | 需要额外获取的数据路径 |
|
18
|
-
| debounceTime | Number | 300 | 防抖时间(毫秒) |
|
19
|
-
| enhanceDict | Object | - | 自定义增强方法 |
|
20
|
-
| local | Boolean | false | 是否启用局部字典,组件配置使用时,才有效 |
|
21
|
-
|
22
|
-
## 字典方法
|
23
|
-
|
24
|
-
| 方法名 | 说明 | 参数 |
|
25
|
-
| ------------- | ------------------------------------------------- | ------------- |
|
26
|
-
| register | 注册字典 | (key, config) |
|
27
|
-
| registerBatch | 批量注册字典 | (config) |
|
28
|
-
| get | 获取字典 | (key, params) |
|
29
|
-
| clear | 清空字典,不传参数则清空所有字典 | (key) |
|
30
|
-
| wait | 等待字典加载完成 ,不传参数则等待所有字典加载完成 | (key) |
|
31
|
-
|
32
|
-
## 字典数据增强方法
|
33
|
-
|
34
|
-
每个字典数组都会被自动注入以下方法:
|
35
|
-
|
36
|
-
| 方法名 | 说明 | 返回值 |
|
37
|
-
| ---------------- | --------------------------- | ------- |
|
38
|
-
| findLabel(value) | 根据值查找对应的标签 | String |
|
39
|
-
| toMap() | 将字典转换为值-标签映射对象 | Object |
|
40
|
-
| values() | 获取所有值的数组 | Array |
|
41
|
-
| labels() | 获取所有标签的数组 | Array |
|
42
|
-
| getOption(value) | 根据值获取完整选项 | Object |
|
43
|
-
| wait() | 等待字典加载完成 | Promise |
|
44
|
-
| ready | 字典是否加载完成的变量 | Boolean |
|
@@ -1,142 +0,0 @@
|
|
1
|
-
# 基本使用
|
2
|
-
|
3
|
-
## 基本使用
|
4
|
-
|
5
|
-
`v-model="data"` 绑定的表单值`data`可以不用声明属性`name`,`gender`来绑定响应式,组件内部会自动进行响应式处理</br>
|
6
|
-
`action` 配置表单按钮
|
7
|
-
|
8
|
-
<ClientOnly>
|
9
|
-
<common-code-format>
|
10
|
-
<form-baseUse-base slot="source"></form-baseUse-base>
|
11
|
-
|
12
|
-
<<< @/docs/.vuepress/components/form/baseUse/base.vue
|
13
|
-
</common-code-format>
|
14
|
-
</ClientOnly>
|
15
|
-
|
16
|
-
|
17
|
-
## 布局
|
18
|
-
|
19
|
-
`layout` 布局类型默认`grid`</br>
|
20
|
-
`layout` 布局类型如果为 `el-row`,则参考element-ui的布局设置</br>
|
21
|
-
### 设置 columns 固定每行列数
|
22
|
-
`columns` 表单列数,`columnGap` 列间距, `rowGap` 行间距 </br>
|
23
|
-
`renderColumns`项中,`widthSize` 占据列数,`heightSize` 占据行数</br>
|
24
|
-
|
25
|
-
<ClientOnly>
|
26
|
-
<common-code-format>
|
27
|
-
<form-baseUse-gridLayout slot="source"></form-baseUse-gridLayout>
|
28
|
-
|
29
|
-
<<< @/docs/.vuepress/components/form/baseUse/gridLayout.vue
|
30
|
-
</common-code-format>
|
31
|
-
</ClientOnly>
|
32
|
-
|
33
|
-
### 设置 columnWidth 固定每列宽度,不固定数量
|
34
|
-
|
35
|
-
<ClientOnly>
|
36
|
-
<common-code-format>
|
37
|
-
<form-baseUse-inlineLayout slot="source"></form-baseUse-inlineLayout>
|
38
|
-
|
39
|
-
<<< @/docs/.vuepress/components/form/baseUse/inlineLayout.vue
|
40
|
-
</common-code-format>
|
41
|
-
</ClientOnly>
|
42
|
-
|
43
|
-
|
44
|
-
## 提示
|
45
|
-
|
46
|
-
`renderColumns`项中,`tooltip` 提示文本,`tooltipRender` 提示渲染函数</br>
|
47
|
-
`#[prop]-tooltip` 提示插槽 </br>
|
48
|
-
|
49
|
-
<ClientOnly>
|
50
|
-
<common-code-format>
|
51
|
-
<form-baseUse-tooltip slot="source"></form-baseUse-tooltip>
|
52
|
-
|
53
|
-
<<< @/docs/.vuepress/components/form/baseUse/tooltip.vue
|
54
|
-
</common-code-format>
|
55
|
-
</ClientOnly>
|
56
|
-
|
57
|
-
|
58
|
-
## label
|
59
|
-
|
60
|
-
`renderColumns`项中,`label` label文本,`labelRender` label渲染函数 </br>
|
61
|
-
`#[prop]-label` label插槽 </br>
|
62
|
-
`hiddenLabel` 隐藏label,在`renderColumns`项中配置单个隐藏 </br>
|
63
|
-
`labelOverTip` label超出隐藏,在`renderColumns`项中配置单个超出隐藏 </br>
|
64
|
-
|
65
|
-
<ClientOnly>
|
66
|
-
<common-code-format>
|
67
|
-
<form-baseUse-label slot="source"></form-baseUse-label>
|
68
|
-
|
69
|
-
<<< @/docs/.vuepress/components/form/baseUse/label.vue
|
70
|
-
</common-code-format>
|
71
|
-
</ClientOnly>
|
72
|
-
|
73
|
-
|
74
|
-
## 校验
|
75
|
-
|
76
|
-
`renderColumns`项中,`required` 必填,`rules` 匹配规则模板和自定义规则</br>
|
77
|
-
详情参考[crud-校验](/guide/crud/validate.html#基本使用)
|
78
|
-
|
79
|
-
<ClientOnly>
|
80
|
-
<common-code-format>
|
81
|
-
<form-baseUse-validate slot="source"></form-baseUse-validate>
|
82
|
-
|
83
|
-
<<< @/docs/.vuepress/components/form/baseUse/validate.vue
|
84
|
-
</common-code-format>
|
85
|
-
</ClientOnly>
|
86
|
-
|
87
|
-
|
88
|
-
## 显示/隐藏
|
89
|
-
|
90
|
-
`renderColumns`项中,`hidden` 隐藏,`show` 显示</br>
|
91
|
-
|
92
|
-
<ClientOnly>
|
93
|
-
<common-code-format>
|
94
|
-
<form-baseUse-hidden slot="source"></form-baseUse-hidden>
|
95
|
-
|
96
|
-
<<< @/docs/.vuepress/components/form/baseUse/hidden.vue
|
97
|
-
</common-code-format>
|
98
|
-
</ClientOnly>
|
99
|
-
|
100
|
-
|
101
|
-
## 分组
|
102
|
-
|
103
|
-
`type: group` 设置分组</br>
|
104
|
-
`renderColumns`项中,`children` 配置表单项 </br>
|
105
|
-
|
106
|
-
<ClientOnly>
|
107
|
-
<common-code-format>
|
108
|
-
<form-baseUse-group slot="source"></form-baseUse-group>
|
109
|
-
|
110
|
-
<<< @/docs/.vuepress/components/form/baseUse/group.vue
|
111
|
-
</common-code-format>
|
112
|
-
</ClientOnly>
|
113
|
-
|
114
|
-
|
115
|
-
## 数据格式化
|
116
|
-
|
117
|
-
当后端接口数据格式与前端不一致时,可以使用`formatData`进行数据格式化</br>
|
118
|
-
`formatData.input` 将外部后端接口的数据格式转化成内部表单所需的格式</br>
|
119
|
-
`formatData.output` 将内部表单的数据格式反转回原来的格式</br>
|
120
|
-
`formatData` 接收字符串时则匹配预设的全局格式化模板</br>
|
121
|
-
`formatData.getFormatValue = true` 可获取格式化后的值,默认绑定在 `scope.row[$ + prop]` 上,如果配置`getFormatValue`为字符串则绑定在 `scope.row[getFormatValue]` 上
|
122
|
-
|
123
|
-
<ClientOnly>
|
124
|
-
<common-code-format>
|
125
|
-
<form-baseUse-dataFormat slot="source"></form-baseUse-dataFormat>
|
126
|
-
|
127
|
-
<<< @/docs/.vuepress/components/form/baseUse/dataFormat.vue
|
128
|
-
</common-code-format>
|
129
|
-
</ClientOnly>
|
130
|
-
|
131
|
-
|
132
|
-
## 深度绑定
|
133
|
-
|
134
|
-
`deepProp` 绑定的对象数据是双向的,改变任意一个,另外一个也会改变
|
135
|
-
|
136
|
-
<ClientOnly>
|
137
|
-
<common-code-format>
|
138
|
-
<form-baseUse-deep slot="source"></form-baseUse-deep>
|
139
|
-
|
140
|
-
<<< @/docs/.vuepress/components/form/baseUse/deep.vue
|
141
|
-
</common-code-format>
|
142
|
-
</ClientOnly>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# 详情模式
|
2
|
-
|
3
|
-
`detail` 配置表单为详情模式 </br>
|
4
|
-
renderColumn项中,`detail` 自定义详情渲染组件
|
5
|
-
|
6
|
-
<ClientOnly>
|
7
|
-
<common-code-format>
|
8
|
-
<form-detail-base slot="source"></form-detail-base>
|
9
|
-
|
10
|
-
<<< @/docs/.vuepress/components/form/detail/base.vue
|
11
|
-
</common-code-format>
|
12
|
-
</ClientOnly>
|
13
|
-
|
14
|
-
|
15
|
-
## 带边框
|
16
|
-
|
17
|
-
`border` 配置表单为详情带边框模式
|
18
|
-
|
19
|
-
<ClientOnly>
|
20
|
-
<common-code-format>
|
21
|
-
<form-detail-border slot="source"></form-detail-border>
|
22
|
-
|
23
|
-
<<< @/docs/.vuepress/components/form/detail/border.vue
|
24
|
-
</common-code-format>
|
25
|
-
</ClientOnly>
|
26
|
-
|
27
|
-
|
28
|
-
## 单个详情
|
29
|
-
|
30
|
-
renderColumn项中,`isDetail` 配置单个详情模式
|
31
|
-
|
32
|
-
<ClientOnly>
|
33
|
-
<common-code-format>
|
34
|
-
<form-detail-singleDetail slot="source"></form-detail-singleDetail>
|
35
|
-
|
36
|
-
<<< @/docs/.vuepress/components/form/detail/singleDetail.vue
|
37
|
-
</common-code-format>
|
38
|
-
</ClientOnly>
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# 基本使用
|
2
|
-
|
3
|
-
## 概述
|
4
|
-
|
5
|
-
数据格式化(formatData)用于解决组件所需数据格式与业务数据格式不一致的问题。它提供了两个核心功能:
|
6
|
-
- `input`: 将业务数据转换为组件所需格式
|
7
|
-
- `output`: 将组件数据转换回业务所需格式
|
8
|
-
|
9
|
-
## 示例
|
10
|
-
|
11
|
-
<ClientOnly>
|
12
|
-
<common-code-format>
|
13
|
-
<formatData-baseUse slot="source"></formatData-baseUse>
|
14
|
-
|
15
|
-
<<< @/docs/.vuepress/components/formatData/baseUse.vue
|
16
|
-
</common-code-format>
|
17
|
-
</ClientOnly>
|
18
|
-
|
19
|
-
## 预设格式化模板
|
20
|
-
|
21
|
-
`formatData` 直接指定预设模板的名称:
|
22
|
-
|
23
|
-
```javascript
|
24
|
-
{
|
25
|
-
label: "省市区",
|
26
|
-
prop: "province",
|
27
|
-
formatData: {
|
28
|
-
type: "multiPropToArr",
|
29
|
-
multiProp: ["province", "city", "district"] // 绑定的多字段参数
|
30
|
-
}
|
31
|
-
}
|
32
|
-
```
|
33
|
-
|
34
|
-
## 自定义当前列的格式化函数
|
35
|
-
|
36
|
-
```javascript
|
37
|
-
{
|
38
|
-
label: "自定义",
|
39
|
-
prop: "custom",
|
40
|
-
formatData: {
|
41
|
-
input: (value) => value.join(","),
|
42
|
-
output: (value) => value.split(","),
|
43
|
-
}
|
44
|
-
}
|
45
|
-
```
|
46
|
-
|
47
|
-
## 格式化值的存储
|
48
|
-
|
49
|
-
如果需要同时保留原始值和格式化后的值,可以通过 `formatValue` 配置存储位置:
|
50
|
-
|
51
|
-
```javascript
|
52
|
-
{
|
53
|
-
label: "金额",
|
54
|
-
prop: "amount",
|
55
|
-
formatData: {
|
56
|
-
formatValue: true, // 格式化后的值会存储在 row.$amount
|
57
|
-
// 或
|
58
|
-
formatValue: "formattedAmount" // 格式化后的值会存储在 row.formattedAmount
|
59
|
-
}
|
60
|
-
}
|
61
|
-
```
|
62
|
-
|
63
|
-
## 全局注册格式化模板
|
64
|
-
|
65
|
-
`item` 即为当前列配置,可以获取到传入的配置信息 prop、label、formatData配置 等
|
66
|
-
|
67
|
-
```javascript
|
68
|
-
import superCrud from "src";
|
69
|
-
|
70
|
-
Vue.use(superCrud, {
|
71
|
-
template: {
|
72
|
-
formatData: {
|
73
|
-
"custom": (item) => {
|
74
|
-
const { prop, label, formatData } = item;
|
75
|
-
return {
|
76
|
-
input: (value) => value.join(","),
|
77
|
-
output: (value) => value.split(","),
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
},
|
82
|
-
});
|
83
|
-
```
|
84
|
-
|
85
|
-
## 在render或插槽渲染中使用
|
86
|
-
|
87
|
-
在render或插槽渲染中使用时,需要使用 `$value` 对象来获取和设置值。
|
88
|
-
|
89
|
-
```javascript
|
90
|
-
{
|
91
|
-
label: "自定义",
|
92
|
-
prop: "custom",
|
93
|
-
formatData: "strToArr",
|
94
|
-
render: (h, { $value }) => {
|
95
|
-
return <el-input value={$value.get} onInput={(v)=>$value.set(v)} />;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
```
|