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,82 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud
|
3
|
+
default-expand-all
|
4
|
+
:search.sync="search"
|
5
|
+
:options="options"
|
6
|
+
:data="data"
|
7
|
+
:total="total"
|
8
|
+
@getList="getList"
|
9
|
+
>
|
10
|
+
</sc-crud>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
data: [
|
18
|
+
{
|
19
|
+
id: 1,
|
20
|
+
name: "部门A",
|
21
|
+
manager: "张三",
|
22
|
+
children: [
|
23
|
+
{
|
24
|
+
id: 11,
|
25
|
+
name: "小组A-1",
|
26
|
+
manager: "李四",
|
27
|
+
children: [
|
28
|
+
{
|
29
|
+
id: 111,
|
30
|
+
name: "成员A-1-1",
|
31
|
+
manager: "",
|
32
|
+
},
|
33
|
+
],
|
34
|
+
},
|
35
|
+
{
|
36
|
+
id: 12,
|
37
|
+
name: "小组A-2",
|
38
|
+
manager: "王五",
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
{
|
43
|
+
id: 2,
|
44
|
+
name: "部门B",
|
45
|
+
manager: "赵六",
|
46
|
+
children: [
|
47
|
+
{
|
48
|
+
id: 21,
|
49
|
+
name: "小组B-1",
|
50
|
+
manager: "",
|
51
|
+
},
|
52
|
+
],
|
53
|
+
},
|
54
|
+
],
|
55
|
+
};
|
56
|
+
},
|
57
|
+
computed: {
|
58
|
+
options() {
|
59
|
+
return {
|
60
|
+
editConfig: {
|
61
|
+
mode: "row",
|
62
|
+
trigger: "manual",
|
63
|
+
edit: {},
|
64
|
+
},
|
65
|
+
renderColumns: [
|
66
|
+
{
|
67
|
+
prop: "name",
|
68
|
+
label: "名称",
|
69
|
+
isEdit: false,
|
70
|
+
},
|
71
|
+
{
|
72
|
+
prop: "manager",
|
73
|
+
label: "负责人",
|
74
|
+
required: true,
|
75
|
+
},
|
76
|
+
],
|
77
|
+
};
|
78
|
+
},
|
79
|
+
},
|
80
|
+
methods: {},
|
81
|
+
};
|
82
|
+
</script>
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog"
|
4
|
+
>component配置弹窗</el-button
|
5
|
+
>
|
6
|
+
<el-button size="small" type="primary" @click="renderDialog"
|
7
|
+
>render函数弹窗</el-button
|
8
|
+
>
|
9
|
+
</div>
|
10
|
+
</template>
|
11
|
+
|
12
|
+
<script>
|
13
|
+
export default {
|
14
|
+
data() {
|
15
|
+
return {
|
16
|
+
form: {},
|
17
|
+
};
|
18
|
+
},
|
19
|
+
computed: {
|
20
|
+
renderColumns() {
|
21
|
+
return [
|
22
|
+
{
|
23
|
+
prop: "name",
|
24
|
+
label: "姓名",
|
25
|
+
},
|
26
|
+
{
|
27
|
+
prop: "age",
|
28
|
+
label: "年龄",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
prop: "sex",
|
32
|
+
label: "性别",
|
33
|
+
comp: {
|
34
|
+
name: "el-checkbox-group",
|
35
|
+
options: [
|
36
|
+
{
|
37
|
+
label: "男",
|
38
|
+
value: "男",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
label: "女",
|
42
|
+
value: "女",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
},
|
47
|
+
];
|
48
|
+
},
|
49
|
+
},
|
50
|
+
methods: {
|
51
|
+
openDialog() {
|
52
|
+
this.$scDialog({
|
53
|
+
title: "comp配置",
|
54
|
+
width: "500px",
|
55
|
+
comp: {
|
56
|
+
name: "sc-form",
|
57
|
+
renderColumns: this.renderColumns,
|
58
|
+
},
|
59
|
+
}).show(
|
60
|
+
() => {
|
61
|
+
console.log(this.form, "this.form");
|
62
|
+
this.$message.success("确认");
|
63
|
+
},
|
64
|
+
() => {
|
65
|
+
this.$message.success("取消");
|
66
|
+
}
|
67
|
+
);
|
68
|
+
},
|
69
|
+
renderDialog() {
|
70
|
+
this.$scDialog({
|
71
|
+
title: "render函数",
|
72
|
+
width: "500px",
|
73
|
+
render: (h, vm) => {
|
74
|
+
return (
|
75
|
+
<sc-form v-model={this.form} renderColumns={this.renderColumns} />
|
76
|
+
);
|
77
|
+
},
|
78
|
+
}).show(
|
79
|
+
() => {
|
80
|
+
console.log(this.form, "this.form");
|
81
|
+
this.$message.success("确认");
|
82
|
+
},
|
83
|
+
() => {
|
84
|
+
this.$message.success("取消");
|
85
|
+
}
|
86
|
+
);
|
87
|
+
},
|
88
|
+
},
|
89
|
+
};
|
90
|
+
</script>
|
91
|
+
|
92
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog"
|
4
|
+
>confirm 弹窗</el-button
|
5
|
+
>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
<script>
|
10
|
+
export default {
|
11
|
+
data() {
|
12
|
+
return {
|
13
|
+
form: {},
|
14
|
+
};
|
15
|
+
},
|
16
|
+
computed: {
|
17
|
+
renderColumns() {
|
18
|
+
return [
|
19
|
+
{
|
20
|
+
prop: "name",
|
21
|
+
label: "姓名",
|
22
|
+
required: true,
|
23
|
+
},
|
24
|
+
{
|
25
|
+
prop: "age",
|
26
|
+
label: "年龄",
|
27
|
+
required: true,
|
28
|
+
},
|
29
|
+
{
|
30
|
+
prop: "sex",
|
31
|
+
label: "性别",
|
32
|
+
comp: {
|
33
|
+
name: "el-checkbox-group",
|
34
|
+
options: [
|
35
|
+
{
|
36
|
+
label: "男",
|
37
|
+
value: "男",
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: "女",
|
41
|
+
value: "女",
|
42
|
+
},
|
43
|
+
],
|
44
|
+
},
|
45
|
+
},
|
46
|
+
];
|
47
|
+
},
|
48
|
+
},
|
49
|
+
methods: {
|
50
|
+
openDialog() {
|
51
|
+
this.$scDialog({
|
52
|
+
title: "弹窗",
|
53
|
+
width: "500px",
|
54
|
+
render: () => (
|
55
|
+
<sc-form
|
56
|
+
ref="form"
|
57
|
+
v-model={this.form}
|
58
|
+
renderColumns={this.renderColumns}
|
59
|
+
/>
|
60
|
+
),
|
61
|
+
confirm: async (cb) => {
|
62
|
+
this.$message.success("确认之前校验表单");
|
63
|
+
await this.$refs.form.validate();
|
64
|
+
cb();
|
65
|
+
console.log(this.form, "this.form");
|
66
|
+
this.$message.success("确认");
|
67
|
+
},
|
68
|
+
cancel: async (cb) => {
|
69
|
+
this.$message.error("取消之前");
|
70
|
+
cb();
|
71
|
+
},
|
72
|
+
}).show();
|
73
|
+
},
|
74
|
+
},
|
75
|
+
};
|
76
|
+
</script>
|
77
|
+
|
78
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog">弹窗</el-button>
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
export default {
|
9
|
+
data() {
|
10
|
+
return {
|
11
|
+
form: {},
|
12
|
+
};
|
13
|
+
},
|
14
|
+
computed: {
|
15
|
+
renderColumns() {
|
16
|
+
return [
|
17
|
+
{
|
18
|
+
prop: "name",
|
19
|
+
label: "姓名",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
prop: "age",
|
23
|
+
label: "年龄",
|
24
|
+
},
|
25
|
+
{
|
26
|
+
prop: "sex",
|
27
|
+
label: "性别",
|
28
|
+
comp: {
|
29
|
+
name: "el-checkbox-group",
|
30
|
+
options: [
|
31
|
+
{
|
32
|
+
label: "男",
|
33
|
+
value: "男",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: "女",
|
37
|
+
value: "女",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
},
|
42
|
+
];
|
43
|
+
},
|
44
|
+
},
|
45
|
+
methods: {
|
46
|
+
openDialog() {
|
47
|
+
const vm = this.$scDialog({
|
48
|
+
title: "手动控制弹窗",
|
49
|
+
width: "500px",
|
50
|
+
render: (h) => {
|
51
|
+
return (
|
52
|
+
<div>
|
53
|
+
<el-button
|
54
|
+
onClick={() => vm.hide()}
|
55
|
+
type="primary"
|
56
|
+
style="margin-bottom: 20px;"
|
57
|
+
>
|
58
|
+
点击关闭弹窗
|
59
|
+
</el-button>
|
60
|
+
<el-button
|
61
|
+
onClick={() => (vm.loading = true)}
|
62
|
+
type="primary"
|
63
|
+
style="margin-bottom: 20px;"
|
64
|
+
>
|
65
|
+
弹窗loading
|
66
|
+
</el-button>
|
67
|
+
</div>
|
68
|
+
);
|
69
|
+
},
|
70
|
+
});
|
71
|
+
vm.show(() => {
|
72
|
+
this.$message.success("确认");
|
73
|
+
});
|
74
|
+
},
|
75
|
+
},
|
76
|
+
};
|
77
|
+
</script>
|
78
|
+
|
79
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog"
|
4
|
+
>抽屉式弹窗</el-button
|
5
|
+
>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
<script>
|
10
|
+
export default {
|
11
|
+
data() {
|
12
|
+
return {
|
13
|
+
form: {},
|
14
|
+
};
|
15
|
+
},
|
16
|
+
computed: {
|
17
|
+
renderColumns() {
|
18
|
+
return [
|
19
|
+
{
|
20
|
+
prop: "name",
|
21
|
+
label: "姓名",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
prop: "age",
|
25
|
+
label: "年龄",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
prop: "sex",
|
29
|
+
label: "性别",
|
30
|
+
comp: {
|
31
|
+
name: "el-checkbox-group",
|
32
|
+
options: [
|
33
|
+
{
|
34
|
+
label: "男",
|
35
|
+
value: "男",
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "女",
|
39
|
+
value: "女",
|
40
|
+
},
|
41
|
+
],
|
42
|
+
},
|
43
|
+
},
|
44
|
+
];
|
45
|
+
},
|
46
|
+
},
|
47
|
+
methods: {
|
48
|
+
openDialog() {
|
49
|
+
this.$scDialog({
|
50
|
+
title: "弹窗",
|
51
|
+
width: "500px",
|
52
|
+
drawer: true,
|
53
|
+
}).show();
|
54
|
+
},
|
55
|
+
},
|
56
|
+
};
|
57
|
+
</script>
|
58
|
+
|
59
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog"
|
4
|
+
>自定义底部按钮</el-button
|
5
|
+
>
|
6
|
+
<el-button size="small" type="primary" @click="openDialog1"
|
7
|
+
>隐藏底部按钮</el-button
|
8
|
+
>
|
9
|
+
</div>
|
10
|
+
</template>
|
11
|
+
|
12
|
+
<script>
|
13
|
+
export default {
|
14
|
+
data() {
|
15
|
+
return {
|
16
|
+
form: {},
|
17
|
+
};
|
18
|
+
},
|
19
|
+
computed: {
|
20
|
+
renderColumns() {
|
21
|
+
return [
|
22
|
+
{
|
23
|
+
prop: "name",
|
24
|
+
label: "姓名",
|
25
|
+
},
|
26
|
+
{
|
27
|
+
prop: "age",
|
28
|
+
label: "年龄",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
prop: "sex",
|
32
|
+
label: "性别",
|
33
|
+
comp: {
|
34
|
+
name: "el-checkbox-group",
|
35
|
+
options: [
|
36
|
+
{
|
37
|
+
label: "男",
|
38
|
+
value: "男",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
label: "女",
|
42
|
+
value: "女",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
},
|
47
|
+
];
|
48
|
+
},
|
49
|
+
},
|
50
|
+
methods: {
|
51
|
+
openDialog() {
|
52
|
+
this.$scDialog({
|
53
|
+
title: "弹窗",
|
54
|
+
width: "500px",
|
55
|
+
footer: {
|
56
|
+
align: "left",
|
57
|
+
confirm: {
|
58
|
+
label: "确认111",
|
59
|
+
type: "primary",
|
60
|
+
},
|
61
|
+
cancel: false,
|
62
|
+
handles: [
|
63
|
+
{
|
64
|
+
label: "自定义",
|
65
|
+
type: "primary",
|
66
|
+
onClick: (vm) => {
|
67
|
+
vm.hide();
|
68
|
+
},
|
69
|
+
},
|
70
|
+
],
|
71
|
+
},
|
72
|
+
}).show();
|
73
|
+
},
|
74
|
+
openDialog1() {
|
75
|
+
this.$scDialog({
|
76
|
+
title: "弹窗",
|
77
|
+
width: "500px",
|
78
|
+
footer: {
|
79
|
+
hidden: true,
|
80
|
+
},
|
81
|
+
}).show();
|
82
|
+
},
|
83
|
+
},
|
84
|
+
};
|
85
|
+
</script>
|
86
|
+
|
87
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button size="small" type="primary" @click="openDialog">弹窗</el-button>
|
4
|
+
<div v-insertSlot="dialogVm">
|
5
|
+
<div v-show="form.radio">v-show</div>
|
6
|
+
<div v-if="form.radio">v-if</div>
|
7
|
+
<div v-for="item in form.sex" :key="item">{{ item }}</div>
|
8
|
+
<sc-form v-model="form" :renderColumns="renderColumns"></sc-form>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
form: {
|
18
|
+
sex: [],
|
19
|
+
},
|
20
|
+
dialogVm: null,
|
21
|
+
};
|
22
|
+
},
|
23
|
+
computed: {
|
24
|
+
renderColumns() {
|
25
|
+
return [
|
26
|
+
{
|
27
|
+
prop: "radio",
|
28
|
+
label: "切换动态更新",
|
29
|
+
comp: {
|
30
|
+
name: "el-radio-group",
|
31
|
+
options: [
|
32
|
+
{
|
33
|
+
label: "隐藏",
|
34
|
+
value: "",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
label: "展示",
|
38
|
+
value: "1",
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
},
|
43
|
+
{
|
44
|
+
prop: "age",
|
45
|
+
label: "年龄",
|
46
|
+
hidden: this.form.radio,
|
47
|
+
},
|
48
|
+
{
|
49
|
+
prop: "sex",
|
50
|
+
label: "v-for",
|
51
|
+
comp: {
|
52
|
+
name: "el-checkbox-group",
|
53
|
+
options: [
|
54
|
+
{
|
55
|
+
label: "1111",
|
56
|
+
value: "1111",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "2222",
|
60
|
+
value: "2222",
|
61
|
+
},
|
62
|
+
],
|
63
|
+
},
|
64
|
+
},
|
65
|
+
];
|
66
|
+
},
|
67
|
+
},
|
68
|
+
methods: {
|
69
|
+
openDialog() {
|
70
|
+
this.dialogVm = this.$scDialog({
|
71
|
+
title: "v-insertSlot弹窗",
|
72
|
+
width: "500px",
|
73
|
+
}).show();
|
74
|
+
},
|
75
|
+
},
|
76
|
+
};
|
77
|
+
</script>
|
78
|
+
|
79
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<template>
|
2
|
+
<el-form v-if="isMounted" :model="form" label-width="80px">
|
3
|
+
<!-- 省份选择 -->
|
4
|
+
<el-form-item label="省份">
|
5
|
+
<el-select v-model="form.province" placeholder="请选择省份" clearable>
|
6
|
+
<el-option
|
7
|
+
v-for="item in $scDict.provinces"
|
8
|
+
:key="item.value"
|
9
|
+
:label="item.label"
|
10
|
+
:value="item.value"
|
11
|
+
/>
|
12
|
+
</el-select>
|
13
|
+
</el-form-item>
|
14
|
+
|
15
|
+
<!-- 城市选择 -->
|
16
|
+
<el-form-item label="城市">
|
17
|
+
<el-select
|
18
|
+
v-model="form.city"
|
19
|
+
placeholder="请选择城市"
|
20
|
+
:disabled="!form.province"
|
21
|
+
clearable
|
22
|
+
>
|
23
|
+
<el-option
|
24
|
+
v-for="item in $scDict.cities"
|
25
|
+
:key="item.value"
|
26
|
+
:label="item.label"
|
27
|
+
:value="item.value"
|
28
|
+
/>
|
29
|
+
</el-select>
|
30
|
+
</el-form-item>
|
31
|
+
|
32
|
+
<!-- 显示选中结果 -->
|
33
|
+
<el-form-item label="当前选择">
|
34
|
+
<div class="selected-info">
|
35
|
+
{{ selectedAddress }}
|
36
|
+
</div>
|
37
|
+
</el-form-item>
|
38
|
+
</el-form>
|
39
|
+
</template>
|
40
|
+
|
41
|
+
<script>
|
42
|
+
import { mockApi } from "../mock";
|
43
|
+
export default {
|
44
|
+
data() {
|
45
|
+
return {
|
46
|
+
form: {
|
47
|
+
province: "",
|
48
|
+
city: "",
|
49
|
+
},
|
50
|
+
isMounted: false,
|
51
|
+
};
|
52
|
+
},
|
53
|
+
computed: {
|
54
|
+
selectedAddress() {
|
55
|
+
if (!this.isMounted) return;
|
56
|
+
if (!this.form.province) return "未选择";
|
57
|
+
const province = this.$scDict.provinces.findLabel(this.form.province);
|
58
|
+
const city = this.$scDict.cities.findLabel(this.form.city);
|
59
|
+
return city ? `${province} - ${city}` : province;
|
60
|
+
},
|
61
|
+
},
|
62
|
+
mounted() {
|
63
|
+
this.isMounted = true;
|
64
|
+
// 注册省份字典
|
65
|
+
this.$scDict.register("provinces", {
|
66
|
+
request: mockApi.getProvinces,
|
67
|
+
immediate: true,
|
68
|
+
});
|
69
|
+
|
70
|
+
// 注册城市字典,使用函数形式的params监听省份变化
|
71
|
+
this.$scDict.register("cities", {
|
72
|
+
request: mockApi.getCities,
|
73
|
+
// 监听省份变化,返回请求参数
|
74
|
+
params: () => this.form.province,
|
75
|
+
});
|
76
|
+
},
|
77
|
+
watch: {
|
78
|
+
// 当省份改变时,清空城市选择
|
79
|
+
"form.province"() {
|
80
|
+
this.form.city = "";
|
81
|
+
},
|
82
|
+
},
|
83
|
+
};
|
84
|
+
</script>
|
85
|
+
|
86
|
+
<style scoped>
|
87
|
+
.selected-info {
|
88
|
+
color: #409eff;
|
89
|
+
font-weight: bold;
|
90
|
+
}
|
91
|
+
</style>
|