vue-super-crud 1.7.1
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/.browserslistrc +3 -0
- package/.versionrc.json +36 -0
- package/CHANGELOG.md +232 -0
- package/LICENSE +201 -0
- package/README.md +46 -0
- package/babel.config.js +12 -0
- package/build/alias.js +10 -0
- package/build/build.js +52 -0
- package/build/config.js +70 -0
- package/deploy.bat +14 -0
- package/docs/.vuepress/components/button/base.vue +88 -0
- package/docs/.vuepress/components/common/code-format.vue +331 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +68 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +73 -0
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +160 -0
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +49 -0
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +91 -0
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +63 -0
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +98 -0
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +72 -0
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +107 -0
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/baseUse/height.vue +82 -0
- package/docs/.vuepress/components/crud/baseUse/index.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/loading.vue +70 -0
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +108 -0
- package/docs/.vuepress/components/crud/baseUse/selection.vue +114 -0
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +118 -0
- package/docs/.vuepress/components/crud/baseUse/title.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/buttons/common.vue +115 -0
- package/docs/.vuepress/components/crud/buttons/fast.vue +82 -0
- package/docs/.vuepress/components/crud/contextMenu/base.vue +72 -0
- package/docs/.vuepress/components/crud/copy.vue +52 -0
- package/docs/.vuepress/components/crud/crudEvents/api.vue +157 -0
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +93 -0
- package/docs/.vuepress/components/crud/crudEvents/events.vue +188 -0
- package/docs/.vuepress/components/crud/dataSort/base.vue +142 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +53 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +111 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +68 -0
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/renderType/1.vue +57 -0
- package/docs/.vuepress/components/crud/renderType/2.vue +63 -0
- package/docs/.vuepress/components/crud/renderType/3.vue +105 -0
- package/docs/.vuepress/components/crud/renderType/5.vue +91 -0
- package/docs/.vuepress/components/crud/search/1.vue +90 -0
- package/docs/.vuepress/components/crud/search/2.vue +78 -0
- package/docs/.vuepress/components/crud/search/3.vue +107 -0
- package/docs/.vuepress/components/crud/search/base.vue +123 -0
- package/docs/.vuepress/components/crud/search/localSearch.vue +124 -0
- package/docs/.vuepress/components/crud/search/special.vue +148 -0
- package/docs/.vuepress/components/crud/selection/events.vue +47 -0
- package/docs/.vuepress/components/crud/selection/pagination.vue +94 -0
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +64 -0
- package/docs/.vuepress/components/crud/span/base.vue +69 -0
- package/docs/.vuepress/components/crud/span/special.vue +75 -0
- package/docs/.vuepress/components/crud/summary/base.vue +99 -0
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +174 -0
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +194 -0
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +219 -0
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +172 -0
- package/docs/.vuepress/components/crud/tableEdit/free.vue +88 -0
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +82 -0
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +154 -0
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +107 -0
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +116 -0
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +98 -0
- package/docs/.vuepress/components/crud/validate/base.vue +122 -0
- package/docs/.vuepress/components/crud/validate/custom.vue +82 -0
- package/docs/.vuepress/components/crud/validate/regulars.vue +88 -0
- package/docs/.vuepress/components/crud/validate/relation.vue +91 -0
- package/docs/.vuepress/components/crud/validate/tree.vue +82 -0
- package/docs/.vuepress/components/dialog/baseUse/base.vue +92 -0
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +78 -0
- package/docs/.vuepress/components/dialog/baseUse/control.vue +79 -0
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +59 -0
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +87 -0
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +79 -0
- package/docs/.vuepress/components/dict/DictLinkage.vue +91 -0
- package/docs/.vuepress/components/dict/baseUse.vue +72 -0
- package/docs/.vuepress/components/dict/component.vue +82 -0
- package/docs/.vuepress/components/dict/localDict.vue +68 -0
- package/docs/.vuepress/components/form/baseUse/base.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +92 -0
- package/docs/.vuepress/components/form/baseUse/deep.vue +57 -0
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +47 -0
- package/docs/.vuepress/components/form/baseUse/group.vue +66 -0
- package/docs/.vuepress/components/form/baseUse/hidden.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/label.vue +51 -0
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/validate.vue +52 -0
- package/docs/.vuepress/components/form/detail/base.vue +78 -0
- package/docs/.vuepress/components/form/detail/border.vue +90 -0
- package/docs/.vuepress/components/form/detail/singleDetail.vue +72 -0
- package/docs/.vuepress/components/formatData/baseUse.vue +131 -0
- package/docs/.vuepress/components/mock/index.js +347 -0
- package/docs/.vuepress/components/mockData/custom.vue +69 -0
- package/docs/.vuepress/components/mockData/example.vue +290 -0
- package/docs/.vuepress/components/positionSlot/base.vue +24 -0
- package/docs/.vuepress/components/positionSlot/form.vue +71 -0
- package/docs/.vuepress/components/positionSlot/table.vue +85 -0
- package/docs/.vuepress/components/tabs/base.vue +57 -0
- package/docs/.vuepress/components/temp.js +195 -0
- package/docs/.vuepress/config.js +146 -0
- package/docs/.vuepress/enhanceApp.js +142 -0
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +25 -0
- package/docs/.vuepress/styles/palette.styl +6 -0
- package/docs/README.md +14 -0
- package/docs/guide/button/base.md +31 -0
- package/docs/guide/commonConfig/jsx.md +166 -0
- package/docs/guide/commonConfig/presetCodeTemplate.md +68 -0
- package/docs/guide/commonConfig/renderType.md +181 -0
- package/docs/guide/crud/baseUse.md +120 -0
- package/docs/guide/crud/buttons.md +18 -0
- package/docs/guide/crud/config.md +217 -0
- package/docs/guide/crud/contextMenu.md +18 -0
- package/docs/guide/crud/dataSort.md +66 -0
- package/docs/guide/crud/genDynamicColumns.md +145 -0
- package/docs/guide/crud/handleBar.md +26 -0
- package/docs/guide/crud/renderType.md +4 -0
- package/docs/guide/crud/search.md +150 -0
- package/docs/guide/crud/selection.md +73 -0
- package/docs/guide/crud/span.md +98 -0
- package/docs/guide/crud/summary.md +167 -0
- package/docs/guide/crud/tableEdit.md +377 -0
- package/docs/guide/crud/validate.md +158 -0
- package/docs/guide/dialog/baseUse.md +81 -0
- package/docs/guide/dict/baseUse.md +174 -0
- package/docs/guide/dict/component.md +88 -0
- package/docs/guide/dict/config.md +44 -0
- package/docs/guide/form/baseUse.md +142 -0
- package/docs/guide/form/detail.md +38 -0
- package/docs/guide/formatData/baseUse.md +98 -0
- package/docs/guide/formatData/config.md +142 -0
- package/docs/guide/mockData/base.md +26 -0
- package/docs/guide/positionSlot/base.md +41 -0
- package/docs/guide/question/base.md +44 -0
- package/docs/guide/start/base.md +30 -0
- package/docs/guide/tabs/base.md +63 -0
- package/examples/App.vue +52 -0
- package/examples/Layout/components/AppMain.vue +40 -0
- package/examples/Layout/components/Item.vue +29 -0
- package/examples/Layout/components/Link.vue +44 -0
- package/examples/Layout/components/SidebarItem.vue +93 -0
- package/examples/Layout/index.vue +69 -0
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +18 -0
- package/examples/main.js +54 -0
- package/examples/router/index.js +140 -0
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +63 -0
- package/examples/styles/sidebar.scss +226 -0
- package/examples/styles/transition.scss +48 -0
- package/examples/styles/variables.scss +25 -0
- package/examples/views/crud/base.vue +68 -0
- package/examples/views/crud/handleRow.vue +84 -0
- package/examples/views/crud/search.vue +116 -0
- package/examples/views/dashboard/index.vue +244 -0
- package/examples/views/dashboard/index1.vue +234 -0
- package/examples/views/dashboard/test.vue +9 -0
- package/examples/views/formTest/index.vue +168 -0
- package/examples/views/nested/menu1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-3/index.vue +5 -0
- package/examples/views/nested/menu2/index.vue +5 -0
- package/gulpfile.js +84 -0
- package/lib/index.css +1 -0
- package/lib/super-crud.min.js +15 -0
- package/package.json +66 -0
- package/packages/button/index.vue +189 -0
- package/packages/core/components/comp.vue +223 -0
- package/packages/core/components/position.vue +135 -0
- package/packages/core/components/render.vue +460 -0
- package/packages/core/configManager.js +302 -0
- package/packages/core/create.js +8 -0
- package/packages/core/defaultRender.js +64 -0
- package/packages/core/dict/global.js +10 -0
- package/packages/core/dict/index.js +432 -0
- package/packages/core/dict/mixin.js +94 -0
- package/packages/core/event.js +60 -0
- package/packages/core/index.js +6 -0
- package/packages/core/init.js +122 -0
- package/packages/core/mock/genConfig.js +228 -0
- package/packages/core/mock/genData.js +422 -0
- package/packages/core/mock/index.js +4 -0
- package/packages/core/rules.js +111 -0
- package/packages/crud/column.vue +205 -0
- package/packages/crud/columnAction.vue +207 -0
- package/packages/crud/columnCell.vue +146 -0
- package/packages/crud/defaultColumn.vue +130 -0
- package/packages/crud/drawerColumn.vue +225 -0
- package/packages/crud/form.vue +69 -0
- package/packages/crud/index.vue +564 -0
- package/packages/crud/menuBar.vue +298 -0
- package/packages/crud/mixins/cacheHandler.js +36 -0
- package/packages/crud/mixins/calcColumnWidth.js +79 -0
- package/packages/crud/mixins/calcHeight.js +105 -0
- package/packages/crud/mixins/columnHandler.js +128 -0
- package/packages/crud/mixins/contextMenu.js +98 -0
- package/packages/crud/mixins/dataProcessor.js +202 -0
- package/packages/crud/mixins/dialog.js +109 -0
- package/packages/crud/mixins/excelHandler.js +150 -0
- package/packages/crud/mixins/exposeMethods.js +107 -0
- package/packages/crud/mixins/generateDynamicColumns.js +250 -0
- package/packages/crud/mixins/props.js +38 -0
- package/packages/crud/mixins/searchHandler.js +151 -0
- package/packages/crud/mixins/select.js +359 -0
- package/packages/crud/mixins/spanMethod.js +288 -0
- package/packages/crud/mixins/summary.js +177 -0
- package/packages/crud/mixins/tableEdit.js +547 -0
- package/packages/crud/mixins/validate.js +219 -0
- package/packages/crud/pagination.vue +110 -0
- package/packages/crud/search.vue +119 -0
- package/packages/crud/searchHeader.vue +231 -0
- package/packages/crud/selectBanner.vue +138 -0
- package/packages/crud/utils/EditState.js +319 -0
- package/packages/crud/utils/excelExport.js +112 -0
- package/packages/crud/utils/excelImport.js +112 -0
- package/packages/crud/utils/index.js +98 -0
- package/packages/dialog/dialog.js +233 -0
- package/packages/dialog/dialog.vue +15 -0
- package/packages/dialog/index.js +22 -0
- package/packages/dict/cascadeFormat.vue +179 -0
- package/packages/dict/dateFormat.vue +40 -0
- package/packages/dict/form/cascade.vue +61 -0
- package/packages/dict/form/checkbox.vue +90 -0
- package/packages/dict/form/extendMethod.js +22 -0
- package/packages/dict/form/input-base.js +31 -0
- package/packages/dict/form/input.js +20 -0
- package/packages/dict/form/radio.vue +69 -0
- package/packages/dict/form/select.vue +118 -0
- package/packages/dict/form/switch.vue +75 -0
- package/packages/dict/valueFormat.vue +188 -0
- package/packages/directive/dialog/drag.js +86 -0
- package/packages/directive/dialog/dragSize.js +42 -0
- package/packages/directive/index.js +9 -0
- package/packages/directive/insertSlot.js +10 -0
- package/packages/form/contextMenu.js +192 -0
- package/packages/form/draftDrawer.vue +391 -0
- package/packages/form/formAction.vue +97 -0
- package/packages/form/formItem.vue +259 -0
- package/packages/form/index.vue +451 -0
- package/packages/form/props.js +15 -0
- package/packages/grid/cell.vue +65 -0
- package/packages/grid/index.vue +130 -0
- package/packages/group/index.vue +96 -0
- package/packages/tabs/index.vue +290 -0
- package/packages/tooltip/index.js +9 -0
- package/packages/tooltip/tooltip.vue +32 -0
- package/packages/tooltip/tooltipComponent.js +38 -0
- package/packages/verifyInput/index.vue +131 -0
- package/src/config/common.js +88 -0
- package/src/config/crud.js +567 -0
- package/src/config/dialog.js +87 -0
- package/src/config/form.js +215 -0
- package/src/config/index.js +9 -0
- package/src/constants/index.js +72 -0
- package/src/index.js +67 -0
- package/src/template/btn/crud.js +6 -0
- package/src/template/btn/dialog.js +1 -0
- package/src/template/btn/form.js +3 -0
- package/src/template/btn/index.js +9 -0
- package/src/template/dicts.js +1 -0
- package/src/template/formatData.js +507 -0
- package/src/template/index.js +19 -0
- package/src/template/render.js +124 -0
- package/src/template/rules.js +53 -0
- package/src/utils/bem.js +49 -0
- package/src/utils/cache.js +77 -0
- package/src/utils/getType.js +34 -0
- package/src/utils/index.js +212 -0
- package/src/utils/mergeTemp.js +124 -0
- package/styles/button.scss +3 -0
- package/styles/crud.scss +425 -0
- package/styles/dialog.scss +95 -0
- package/styles/form.scss +532 -0
- package/styles/group.scss +78 -0
- package/styles/index.scss +94 -0
- package/styles/tabs.scss +139 -0
- package/styles/verifyInput.scss +56 -0
- package/vue-jsx-sync.js +90 -0
- package/vue.config.js +54 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
// // enhanceApp.js
|
2
|
+
// import VueHighlightJS from "vue-highlight.js";
|
3
|
+
import "highlight.js/styles/atom-one-dark.css";
|
4
|
+
// import ElementUI from "element-ui";
|
5
|
+
import "element-ui/lib/theme-chalk/index.css";
|
6
|
+
// // import Package from "../../lib/sc-crud";
|
7
|
+
// // import "../../lib/index.css";
|
8
|
+
// import Package from "../../src/index";
|
9
|
+
// // import Contextmenu from "vue-contextmenujs";
|
10
|
+
import "../../styles/index.scss";
|
11
|
+
|
12
|
+
export default async ({ Vue }) => {
|
13
|
+
if (typeof window !== "undefined") {
|
14
|
+
// 动态导入插件
|
15
|
+
const [
|
16
|
+
{ default: VueHighlightJS },
|
17
|
+
{ default: ElementUI },
|
18
|
+
{ default: Package },
|
19
|
+
{ default: Contextmenu },
|
20
|
+
] = await Promise.all([
|
21
|
+
import("vue-highlight.js"),
|
22
|
+
import("element-ui"),
|
23
|
+
import("../../src/index"),
|
24
|
+
import("vue-contextmenujs"),
|
25
|
+
]);
|
26
|
+
|
27
|
+
// // 导入样式
|
28
|
+
// await Promise.all([
|
29
|
+
// import("highlight.js/styles/atom-one-dark.css"),
|
30
|
+
// import("element-ui/lib/theme-chalk/index.css"),
|
31
|
+
// import("../../lib/index.css"),
|
32
|
+
// ]);
|
33
|
+
|
34
|
+
Vue.use(VueHighlightJS);
|
35
|
+
Vue.use(ElementUI, {
|
36
|
+
size: "small",
|
37
|
+
});
|
38
|
+
Vue.use(Package, {
|
39
|
+
crudOptions: {
|
40
|
+
gap: 0,
|
41
|
+
border: true,
|
42
|
+
},
|
43
|
+
dict: {
|
44
|
+
request: (key) => {
|
45
|
+
const data = {
|
46
|
+
cascade: [
|
47
|
+
{
|
48
|
+
label: "选项1",
|
49
|
+
value: "1",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
label: "选项1-1",
|
53
|
+
value: "1-1",
|
54
|
+
},
|
55
|
+
{
|
56
|
+
label: "选项1-2",
|
57
|
+
value: "1-2",
|
58
|
+
},
|
59
|
+
],
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: "选项2",
|
63
|
+
value: "2",
|
64
|
+
},
|
65
|
+
],
|
66
|
+
gender: [
|
67
|
+
{
|
68
|
+
label: "男",
|
69
|
+
value: "1",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: "女",
|
73
|
+
value: "2",
|
74
|
+
},
|
75
|
+
],
|
76
|
+
gender1: [
|
77
|
+
{
|
78
|
+
label: "男",
|
79
|
+
value: "1",
|
80
|
+
},
|
81
|
+
{
|
82
|
+
label: "女",
|
83
|
+
value: "2",
|
84
|
+
},
|
85
|
+
],
|
86
|
+
};
|
87
|
+
return Promise.resolve({ data: data[key] });
|
88
|
+
},
|
89
|
+
},
|
90
|
+
template: {
|
91
|
+
crud: {
|
92
|
+
uniqueId: true,
|
93
|
+
handleRow: {
|
94
|
+
tempGlobalButton: {
|
95
|
+
label: "自定义temp按钮",
|
96
|
+
icon: "el-icon-eleme",
|
97
|
+
onClick: () => {
|
98
|
+
console.log("自定义temp按钮");
|
99
|
+
},
|
100
|
+
},
|
101
|
+
},
|
102
|
+
},
|
103
|
+
dicts: {
|
104
|
+
getList: (item) => ({
|
105
|
+
request: (params, done) => {
|
106
|
+
const data = [
|
107
|
+
{
|
108
|
+
label: "男",
|
109
|
+
value: "1",
|
110
|
+
},
|
111
|
+
{
|
112
|
+
label: "女",
|
113
|
+
value: "2",
|
114
|
+
},
|
115
|
+
];
|
116
|
+
setTimeout(() => {
|
117
|
+
done(data);
|
118
|
+
}, 500);
|
119
|
+
},
|
120
|
+
}),
|
121
|
+
},
|
122
|
+
render: {
|
123
|
+
testCodeTemplate: (item) => ({
|
124
|
+
search: {
|
125
|
+
comp: {
|
126
|
+
name: item.searchCompName,
|
127
|
+
type: item.SearchCompType,
|
128
|
+
},
|
129
|
+
},
|
130
|
+
form: {
|
131
|
+
comp: {
|
132
|
+
name: item.formCompName,
|
133
|
+
},
|
134
|
+
},
|
135
|
+
formatter: (row) => row[item.prop] + "自定义格式化",
|
136
|
+
}),
|
137
|
+
},
|
138
|
+
},
|
139
|
+
});
|
140
|
+
Vue.use(Contextmenu);
|
141
|
+
}
|
142
|
+
};
|
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.dark .content__default code {
|
2
|
+
background-color: rgba(57, 197, 187, 1);
|
3
|
+
}
|
4
|
+
.page {
|
5
|
+
transform: unset !important;
|
6
|
+
overflow: visible !important;
|
7
|
+
}
|
8
|
+
.page-title {
|
9
|
+
display: none
|
10
|
+
}
|
11
|
+
.language-vue {
|
12
|
+
border-radius: 0 !important;
|
13
|
+
}
|
14
|
+
|
15
|
+
.el-table__expand-icon>.el-icon {
|
16
|
+
margin-top: -5px !important;
|
17
|
+
}
|
18
|
+
.el-table tr {
|
19
|
+
background-color: #fff !important;
|
20
|
+
}
|
21
|
+
|
22
|
+
.content {
|
23
|
+
margin: 0 !important;
|
24
|
+
padding: 0 !important;
|
25
|
+
}
|
package/docs/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
home: true
|
3
|
+
heroImage: /super.png
|
4
|
+
actionText: 快速上手 →
|
5
|
+
actionLink: /guide/start/base.md
|
6
|
+
features:
|
7
|
+
- title: 快速开发
|
8
|
+
details: 极少的代码即可完成一个crud页面。
|
9
|
+
- title: 模板复用
|
10
|
+
details: 配置并复用代码模板,减少重复开发,提升开发效率。
|
11
|
+
- title: 高度自定义
|
12
|
+
details: 灵活、丰富的配置,以满足不同项目的高度自定义需求
|
13
|
+
footer: MIT Licensed | Copyright © 2019-2020 present Greper
|
14
|
+
---
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# 基本使用
|
2
|
+
|
3
|
+
## 概述
|
4
|
+
|
5
|
+
基于 el-button 的增强型按钮组件,提供了防抖、确认框、下拉菜单等多种交互功能。
|
6
|
+
|
7
|
+
## 示例
|
8
|
+
|
9
|
+
<ClientOnly>
|
10
|
+
<common-code-format>
|
11
|
+
<button-base slot="source"></button-base>
|
12
|
+
|
13
|
+
<<< @/docs/.vuepress/components/button/base.vue
|
14
|
+
</common-code-format>
|
15
|
+
</ClientOnly>
|
16
|
+
|
17
|
+
## API
|
18
|
+
|
19
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
20
|
+
| ------------- | ---------------- | --------------------- | ------ |
|
21
|
+
| type | 按钮类型 | String | - |
|
22
|
+
| size | 按钮大小 | String | mini |
|
23
|
+
| disabled | 是否禁用 | Boolean | false |
|
24
|
+
| label | 按钮文本 | String | - |
|
25
|
+
| hidden | 是否隐藏 | Boolean | - |
|
26
|
+
| show | 是否显示 | Boolean | - |
|
27
|
+
| children | 下拉菜单项 | Array | - |
|
28
|
+
| time | 防抖时间(ms) | Number | 300 |
|
29
|
+
| confirm | 确认框配置 | Boolean/String/Object | - |
|
30
|
+
| customConfirm | 自定义确认框配置 | Object | - |
|
31
|
+
| textSubmit | 文本提交配置 | Object | - |
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# JSX 语法
|
2
|
+
|
3
|
+
## 内容
|
4
|
+
|
5
|
+
```jsx
|
6
|
+
render() {
|
7
|
+
return <p>hello</p>
|
8
|
+
}
|
9
|
+
```
|
10
|
+
|
11
|
+
### 具有动态内容:
|
12
|
+
|
13
|
+
```jsx
|
14
|
+
render() {
|
15
|
+
return <p>hello { this.message }</p>
|
16
|
+
}
|
17
|
+
```
|
18
|
+
|
19
|
+
### 单标签:
|
20
|
+
|
21
|
+
```jsx
|
22
|
+
render() {
|
23
|
+
return <input />
|
24
|
+
}
|
25
|
+
```
|
26
|
+
|
27
|
+
### 使用组件:
|
28
|
+
|
29
|
+
```jsx
|
30
|
+
import MyComponent from './my-component'
|
31
|
+
|
32
|
+
export default {
|
33
|
+
render() {
|
34
|
+
return <MyComponent>hello</MyComponent>
|
35
|
+
},
|
36
|
+
}
|
37
|
+
```
|
38
|
+
|
39
|
+
## 属性
|
40
|
+
|
41
|
+
```jsx
|
42
|
+
render() {
|
43
|
+
return <input type="email" />
|
44
|
+
}
|
45
|
+
```
|
46
|
+
|
47
|
+
### 使用动态绑定:
|
48
|
+
|
49
|
+
```jsx
|
50
|
+
render() {
|
51
|
+
return <input
|
52
|
+
type="email"
|
53
|
+
placeholder={this.placeholderText}
|
54
|
+
/>
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
### 绑定事件:
|
59
|
+
|
60
|
+
```jsx
|
61
|
+
render() {
|
62
|
+
return <input onInput={this.handleInput} />
|
63
|
+
}
|
64
|
+
```
|
65
|
+
|
66
|
+
### 动态绑定事件:
|
67
|
+
|
68
|
+
```jsx
|
69
|
+
render() {
|
70
|
+
const events = {
|
71
|
+
"visible-change": () => {
|
72
|
+
console.log("visible-change");
|
73
|
+
},
|
74
|
+
}
|
75
|
+
return <input on={events} />
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
### 动态属性:
|
81
|
+
|
82
|
+
```jsx
|
83
|
+
render() {
|
84
|
+
const props = {
|
85
|
+
type: 'email',
|
86
|
+
placeholder: 'Enter your email'
|
87
|
+
}
|
88
|
+
|
89
|
+
return <input props={props} />
|
90
|
+
}
|
91
|
+
```
|
92
|
+
|
93
|
+
### 使用扩展运算符:
|
94
|
+
|
95
|
+
```jsx
|
96
|
+
render() {
|
97
|
+
const inputAttrs = {
|
98
|
+
type: 'email',
|
99
|
+
placeholder: 'Enter your email'
|
100
|
+
}
|
101
|
+
|
102
|
+
return <input {...{ attrs: inputAttrs }} />
|
103
|
+
}
|
104
|
+
```
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
## 插槽
|
109
|
+
|
110
|
+
### 命名插槽:
|
111
|
+
|
112
|
+
```jsx
|
113
|
+
render() {
|
114
|
+
return (
|
115
|
+
<MyComponent>
|
116
|
+
<header slot="header">header</header>
|
117
|
+
<footer slot="footer">footer</footer>
|
118
|
+
</MyComponent>
|
119
|
+
)
|
120
|
+
}
|
121
|
+
```
|
122
|
+
|
123
|
+
### 作用域插槽:
|
124
|
+
|
125
|
+
```jsx
|
126
|
+
render() {
|
127
|
+
const scopedSlots = {
|
128
|
+
header: () => <header>header</header>,
|
129
|
+
footer: () => <footer>footer</footer>
|
130
|
+
}
|
131
|
+
|
132
|
+
return <MyComponent scopedSlots={scopedSlots} />
|
133
|
+
}
|
134
|
+
```
|
135
|
+
|
136
|
+
## 指令
|
137
|
+
|
138
|
+
```jsx
|
139
|
+
<input vModel={this.newTodoText} />
|
140
|
+
// or
|
141
|
+
<input v-model={this.newTodoText} />
|
142
|
+
```
|
143
|
+
|
144
|
+
### 使用修饰符:
|
145
|
+
|
146
|
+
```jsx
|
147
|
+
<input vModel_trim={this.newTodoText} />
|
148
|
+
```
|
149
|
+
|
150
|
+
### 带有参数:
|
151
|
+
|
152
|
+
```jsx
|
153
|
+
<input vOn:click={this.newTodoText} />
|
154
|
+
```
|
155
|
+
|
156
|
+
### 带有参数和修饰符:
|
157
|
+
|
158
|
+
```jsx
|
159
|
+
<input vOn:click_stop_prevent={this.newTodoText} />
|
160
|
+
```
|
161
|
+
|
162
|
+
### v-html:
|
163
|
+
|
164
|
+
```jsx
|
165
|
+
<p domPropsInnerHTML={html} />
|
166
|
+
```
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# 预设配置模板
|
2
|
+
|
3
|
+
## 基本使用
|
4
|
+
|
5
|
+
`presetType` 匹配预设的配置,实现配置复用。</br>
|
6
|
+
|
7
|
+
通用`presetType` 匹配到的配置对象会与原有的配置合并,形成一个新的配置对象,达到配置复用的效果。
|
8
|
+
|
9
|
+
<ClientOnly>
|
10
|
+
<common-code-format>
|
11
|
+
<commonConfig-presetCodeTemplate-base slot="source"></commonConfig-presetCodeTemplate-base>
|
12
|
+
|
13
|
+
<<< @/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue
|
14
|
+
</common-code-format>
|
15
|
+
</ClientOnly>
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## 预设配置的动态化
|
20
|
+
|
21
|
+
预设的配置如果是一个函数,接收的参数为原有的配置对象`item`,可以动态的返回一个配置对象,实现配置的动态化。
|
22
|
+
|
23
|
+
<ClientOnly>
|
24
|
+
<common-code-format>
|
25
|
+
<commonConfig-presetCodeTemplate-customParams slot="source"></commonConfig-presetCodeTemplate-customParams>
|
26
|
+
|
27
|
+
<<< @/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue
|
28
|
+
</common-code-format>
|
29
|
+
</ClientOnly>
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# 自定义预设配置
|
34
|
+
|
35
|
+
::: tip
|
36
|
+
在全局配置对象 `template` 下添加新的预设配置 。
|
37
|
+
:::
|
38
|
+
|
39
|
+
```js
|
40
|
+
|
41
|
+
Vue.use(superCrud, {
|
42
|
+
template: {
|
43
|
+
render: { // 渲染模板
|
44
|
+
dateRange: () => ({
|
45
|
+
comp: {
|
46
|
+
name: "el-date-picker",
|
47
|
+
type: "daterange",
|
48
|
+
"range-separator": "-",
|
49
|
+
"start-placeholder": "开始",
|
50
|
+
"end-placeholder": "结束",
|
51
|
+
valueFormat: "yyyy-MM-dd",
|
52
|
+
},
|
53
|
+
}),
|
54
|
+
},
|
55
|
+
rules: { // 校验模板
|
56
|
+
required: (rules, { item }) => {
|
57
|
+
return {
|
58
|
+
required: true,
|
59
|
+
message: item.label + "不能为空",
|
60
|
+
trigger: item.rules.trigger,
|
61
|
+
};
|
62
|
+
},
|
63
|
+
},
|
64
|
+
dict: { // 字典模板
|
65
|
+
...
|
66
|
+
},
|
67
|
+
}})
|
68
|
+
```
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# 渲染方式
|
2
|
+
|
3
|
+
## 格式化渲染
|
4
|
+
|
5
|
+
`formatter` 用于格式化数据,返回处理后的文本内容 </br>
|
6
|
+
`html` 配合 formatter 使用,可以渲染 HTML 字符串
|
7
|
+
|
8
|
+
<ClientOnly>
|
9
|
+
<common-code-format>
|
10
|
+
<commonConfig-renderType-formatter slot="source"></commonConfig-renderType-formatter>
|
11
|
+
<<< @/docs/.vuepress/components/commonConfig/renderType/formatter.vue
|
12
|
+
</common-code-format>
|
13
|
+
</ClientOnly>
|
14
|
+
|
15
|
+
## 插槽渲染
|
16
|
+
|
17
|
+
`#[prop]` 插槽名称与 renderColumns 的 prop 属性对应 </br>
|
18
|
+
插槽可以接收`scope`作为作用域参数
|
19
|
+
|
20
|
+
<ClientOnly>
|
21
|
+
<common-code-format>
|
22
|
+
<commonConfig-renderType-slot slot="source"></commonConfig-renderType-slot>
|
23
|
+
<<< @/docs/.vuepress/components/commonConfig/renderType/slot.vue
|
24
|
+
</common-code-format>
|
25
|
+
</ClientOnly>
|
26
|
+
|
27
|
+
## render函数渲染
|
28
|
+
|
29
|
+
使用 render 函数或 JSX 语法进行渲染 </br>
|
30
|
+
当 render 函数接收一个参数时,参数为`scope`;当 render 函数接收两个参数时,第一个参数为`h`,第二个参数为`scope`
|
31
|
+
|
32
|
+
<ClientOnly>
|
33
|
+
<common-code-format>
|
34
|
+
<commonConfig-renderType-render slot="source"></commonConfig-renderType-render>
|
35
|
+
<<< @/docs/.vuepress/components/commonConfig/renderType/render.vue
|
36
|
+
</common-code-format>
|
37
|
+
</ClientOnly>
|
38
|
+
|
39
|
+
## 组件配置渲染
|
40
|
+
|
41
|
+
通过配置对象`comp`来定义组件的各种行为和属性 </br>
|
42
|
+
|
43
|
+
默认配置:
|
44
|
+
- clearable: 默认为 true </br>
|
45
|
+
- placeholder: 默认为"请输入/请选择" + 列标签 </br>
|
46
|
+
- size: 继承父组件的 size 配置 </br>
|
47
|
+
|
48
|
+
<ClientOnly>
|
49
|
+
<common-code-format>
|
50
|
+
<commonConfig-renderType-component slot="source"></commonConfig-renderType-component>
|
51
|
+
<<< @/docs/.vuepress/components/commonConfig/renderType/component.vue
|
52
|
+
</common-code-format>
|
53
|
+
</ClientOnly>
|
54
|
+
|
55
|
+
### 组件类型转换
|
56
|
+
|
57
|
+
原先名字为 el-select 的组件会转化为封装的 sc-select 组件,支持 options 配置, 快速生成选项,[字典组件配置](/guide/dict/component.html#字典组件配置)
|
58
|
+
|
59
|
+
| 原组件 | 转换后组件 |
|
60
|
+
| ----------------- | ----------- |
|
61
|
+
| el-select | sc-select |
|
62
|
+
| el-checkbox-group | sc-checkbox |
|
63
|
+
| el-radio-group | sc-radio |
|
64
|
+
| el-switch | sc-switch |
|
65
|
+
| el-cascader | sc-cascader |
|
66
|
+
|
67
|
+
### 组件属性设置
|
68
|
+
支持两种方式设置组件属性:
|
69
|
+
1. 直接属性配置
|
70
|
+
```js
|
71
|
+
{
|
72
|
+
name: 'el-input',
|
73
|
+
type: 'text',
|
74
|
+
placeholder: '请输入',
|
75
|
+
clearable: true
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
2. bind 配置,支持函数形式,可获取 scope 参数
|
80
|
+
```js
|
81
|
+
{
|
82
|
+
name: 'el-input',
|
83
|
+
bind: {
|
84
|
+
placeholder: '请输入',
|
85
|
+
clearable: true
|
86
|
+
}
|
87
|
+
}
|
88
|
+
```
|
89
|
+
|
90
|
+
### 事件处理配置
|
91
|
+
|
92
|
+
组件支持两种事件配置方式:
|
93
|
+
|
94
|
+
1. on 对象配置
|
95
|
+
```js
|
96
|
+
{
|
97
|
+
name: 'el-input',
|
98
|
+
on: {
|
99
|
+
change: (val, scope) => {
|
100
|
+
console.log('值变化:', val)
|
101
|
+
},
|
102
|
+
input: (val, scope) => {
|
103
|
+
console.log('输入值:', val)
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
```
|
108
|
+
|
109
|
+
2. on 前缀配置
|
110
|
+
```js
|
111
|
+
{
|
112
|
+
name: 'el-input',
|
113
|
+
onChange: (val, scope) => {
|
114
|
+
console.log('值变化:', val)
|
115
|
+
},
|
116
|
+
onInput: (val, scope) => {
|
117
|
+
console.log('输入值:', val)
|
118
|
+
}
|
119
|
+
}
|
120
|
+
```
|
121
|
+
|
122
|
+
### children 属性详细说明
|
123
|
+
|
124
|
+
children 属性用于配置组件的子元素,支持多种配置方式,常用于下拉选择、单选组、复选组等需要子组件、子元素的场景。
|
125
|
+
|
126
|
+
1. 返回子组件,支持数组与对象
|
127
|
+
```js
|
128
|
+
{
|
129
|
+
name: 'el-select',
|
130
|
+
children: [
|
131
|
+
{ name: 'el-option', label: '选项1', value: 1 },
|
132
|
+
{ name: 'el-option', label: '选项2', value: 2 }
|
133
|
+
] // { name: 'el-option', label: '选项1', value: 1 }
|
134
|
+
}
|
135
|
+
```
|
136
|
+
|
137
|
+
2. 函数形式
|
138
|
+
```js
|
139
|
+
{
|
140
|
+
name: 'el-select',
|
141
|
+
children: (scope) => {
|
142
|
+
return scope.dict.map(item => ({
|
143
|
+
name: 'el-option',
|
144
|
+
label: item.label,
|
145
|
+
value: item.value
|
146
|
+
}))
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
```
|
151
|
+
|
152
|
+
3. 返回子元素
|
153
|
+
```js
|
154
|
+
{
|
155
|
+
name: 'el-button',
|
156
|
+
children: '按钮'
|
157
|
+
}
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
## comp 配置项
|
162
|
+
|
163
|
+
| 配置项 | 类型 | 说明 | 示例 |
|
164
|
+
| -------- | --------------------- | -------------------------------------------------- | ------------------------------------------ |
|
165
|
+
| name | String/Component | 组件名称或组件对象。字符串时必须为已注册的全局组件 | 'el-input' 或 导入的组件 |
|
166
|
+
| bind | Object/Function | 组件的属性配置,函数时可获取 scope 参数 | {placeholder: '请输入'} 或 (scope) => ({}) |
|
167
|
+
| on | Object | 组件的事件监听配置 | {change: (val, scope) => {}} |
|
168
|
+
| slots | Object | 组件的插槽配置,接收render函数 | {default: (h, scope) => []} |
|
169
|
+
| children | Array/Object/Function | 子组件配置或默认插槽内容 | [{name: 'el-option'}] |
|
170
|
+
| nativeOn | Object | 原生事件监听 | {click: () => {}} |
|
171
|
+
| mounted | Function(scope, ref) | 组件挂载后调用 | (scope, ref) => {} |
|
172
|
+
|
173
|
+
|
174
|
+
## scope 作用域对象
|
175
|
+
|
176
|
+
| 属性 | 说明 |
|
177
|
+
| ------ | -------------------------------------------------------- |
|
178
|
+
| row | 当前行数据 |
|
179
|
+
| self | 当前组件实例 |
|
180
|
+
| dict | 字典数据 |
|
181
|
+
| $value | 格式化值的 get/set,{ get: () => {} , set: (val) => {} } |
|