vue-super-crud 1.7.1 → 1.7.4
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/src/config/common.js +2 -1
- package/src/config/crud.js +3 -3
- package/src/index.js +4 -0
- package/src/template/formatData.js +75 -87
- 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,168 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<sc-form v-model="formData" ref="form" :options="options"> </sc-form>
|
4
|
-
<el-button type="primary" size="default" @click="openDialog(false)"
|
5
|
-
>Dialog</el-button
|
6
|
-
>
|
7
|
-
<el-button type="primary" size="default" @click="openDialog(true)"
|
8
|
-
>Drawer</el-button
|
9
|
-
>
|
10
|
-
<div>字典数据:{{ $sc_dicts.data["sys_notice_status"] }}</div>
|
11
|
-
</div>
|
12
|
-
</template>
|
13
|
-
|
14
|
-
<script>
|
15
|
-
export default {
|
16
|
-
data() {
|
17
|
-
return {
|
18
|
-
checkList: [],
|
19
|
-
formData: {
|
20
|
-
checkList1: ["张三", "李四"],
|
21
|
-
dateStart: "2022-01-03",
|
22
|
-
dateEnd: "2022-01-25",
|
23
|
-
},
|
24
|
-
dictData: [
|
25
|
-
{
|
26
|
-
value: "张三",
|
27
|
-
label: "1111",
|
28
|
-
},
|
29
|
-
{
|
30
|
-
value: "李四",
|
31
|
-
label: "2222",
|
32
|
-
},
|
33
|
-
],
|
34
|
-
a: {
|
35
|
-
value: "张三",
|
36
|
-
label: "1111",
|
37
|
-
},
|
38
|
-
};
|
39
|
-
},
|
40
|
-
mounted() {
|
41
|
-
this.$sc_dicts.get(["sys_status", "sys_notice_status", "listAll"]);
|
42
|
-
|
43
|
-
setTimeout(() => {
|
44
|
-
console.log(this.$sc_dicts.getMap("listAll"));
|
45
|
-
}, 1000);
|
46
|
-
},
|
47
|
-
computed: {
|
48
|
-
options() {
|
49
|
-
return {
|
50
|
-
// detail: true,
|
51
|
-
action: {
|
52
|
-
search: {},
|
53
|
-
reset: {},
|
54
|
-
},
|
55
|
-
renderColumns: [
|
56
|
-
{
|
57
|
-
label: "11111",
|
58
|
-
icon: "el-icon-user",
|
59
|
-
collapse: false,
|
60
|
-
children: [
|
61
|
-
{
|
62
|
-
label: "年龄",
|
63
|
-
prop: "name",
|
64
|
-
labelPosition: "top",
|
65
|
-
comp: (scope) => {
|
66
|
-
return {
|
67
|
-
name: "el-select",
|
68
|
-
clearable: true,
|
69
|
-
on: {
|
70
|
-
change(v, a, vm) {
|
71
|
-
console.log(v, a, vm, scope);
|
72
|
-
},
|
73
|
-
},
|
74
|
-
children: (this.$sc_dicts.data["sys_notice_status"] || []).map(
|
75
|
-
(i) => ({
|
76
|
-
name: "el-option",
|
77
|
-
label: i.label,
|
78
|
-
value: i.value,
|
79
|
-
})
|
80
|
-
),
|
81
|
-
};
|
82
|
-
},
|
83
|
-
rules: {
|
84
|
-
required: {},
|
85
|
-
},
|
86
|
-
},
|
87
|
-
{
|
88
|
-
label: "日期",
|
89
|
-
prop: "dateStart-dateEnd",
|
90
|
-
formatTemp: {
|
91
|
-
inner: (value, key, inner, outer) => {
|
92
|
-
return value;
|
93
|
-
},
|
94
|
-
outer: (value, key, outer, inner) => {
|
95
|
-
return value;
|
96
|
-
},
|
97
|
-
},
|
98
|
-
render: (h, { form }) => {
|
99
|
-
return (
|
100
|
-
<el-date-picker
|
101
|
-
v-model={form["dateStart-dateEnd"]}
|
102
|
-
value-format="yyyy-MM-dd"
|
103
|
-
type="daterange"
|
104
|
-
range-separator="至"
|
105
|
-
start-placeholder="开始日期"
|
106
|
-
end-placeholder="结束日期"
|
107
|
-
></el-date-picker>
|
108
|
-
);
|
109
|
-
},
|
110
|
-
},
|
111
|
-
],
|
112
|
-
},
|
113
|
-
{
|
114
|
-
label: "11111",
|
115
|
-
children: [
|
116
|
-
{
|
117
|
-
label: "年龄",
|
118
|
-
prop: "checkList",
|
119
|
-
rules: {
|
120
|
-
required: {},
|
121
|
-
},
|
122
|
-
formatTemp: "str2array",
|
123
|
-
comp: (scope) => {
|
124
|
-
return {
|
125
|
-
name: "el-checkbox-group",
|
126
|
-
children: this.dictData.map((i) => ({
|
127
|
-
name: "el-checkbox",
|
128
|
-
label: i.value,
|
129
|
-
children: i.label,
|
130
|
-
})),
|
131
|
-
};
|
132
|
-
},
|
133
|
-
},
|
134
|
-
],
|
135
|
-
},
|
136
|
-
],
|
137
|
-
};
|
138
|
-
},
|
139
|
-
},
|
140
|
-
methods: {
|
141
|
-
openDialog(drawer) {
|
142
|
-
const dialog = this.$dialog({
|
143
|
-
drawer,
|
144
|
-
presetType: "success-msg",
|
145
|
-
// class: "1231231",
|
146
|
-
// title: "测试",
|
147
|
-
// width: "1000px",
|
148
|
-
// cache: true,
|
149
|
-
// comp: {
|
150
|
-
// name: "div",
|
151
|
-
// children: "12321312",
|
152
|
-
// },
|
153
|
-
// render: () => {
|
154
|
-
// return <div ref="test">23423432</div>;
|
155
|
-
// },
|
156
|
-
beforeClose: (done, val) => {
|
157
|
-
if (val === "cancel") {
|
158
|
-
done();
|
159
|
-
}
|
160
|
-
},
|
161
|
-
});
|
162
|
-
dialog.show().then((res) => {});
|
163
|
-
},
|
164
|
-
},
|
165
|
-
};
|
166
|
-
</script>
|
167
|
-
|
168
|
-
<style lang="scss" scoped></style>
|
package/gulpfile.js
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
const gulp = require("gulp");
|
2
|
-
const sass = require("gulp-sass")(require("sass"));
|
3
|
-
var autoprefixer = require("gulp-autoprefixer");
|
4
|
-
var cssmin = require("gulp-cssmin");
|
5
|
-
const webpack = require("webpack");
|
6
|
-
const webpackConf = require("./build/build.js");
|
7
|
-
|
8
|
-
// 构建webpack配置
|
9
|
-
gulp.task("webpack", async function () {
|
10
|
-
try {
|
11
|
-
const stats = await new Promise((resolve, reject) => {
|
12
|
-
webpack(webpackConf, (err, stats) => {
|
13
|
-
if (err) {
|
14
|
-
reject(err);
|
15
|
-
return;
|
16
|
-
}
|
17
|
-
resolve(stats);
|
18
|
-
});
|
19
|
-
});
|
20
|
-
|
21
|
-
// 处理编译过程中的错误和警告
|
22
|
-
const info = stats.toJson();
|
23
|
-
|
24
|
-
if (stats.hasErrors()) {
|
25
|
-
console.error("\x1b[31m%s\x1b[0m", "打包失败!"); // 红色文字
|
26
|
-
console.error(info.errors);
|
27
|
-
throw new Error("Webpack 编译失败");
|
28
|
-
}
|
29
|
-
|
30
|
-
if (stats.hasWarnings()) {
|
31
|
-
console.warn("\x1b[33m%s\x1b[0m", "打包警告:"); // 黄色文字
|
32
|
-
console.warn(info.warnings);
|
33
|
-
}
|
34
|
-
|
35
|
-
console.log("\x1b[32m%s\x1b[0m", "打包成功!"); // 绿色文字
|
36
|
-
} catch (error) {
|
37
|
-
console.error("\x1b[31m%s\x1b[0m", "打包过程发生错误:"); // 红色文字
|
38
|
-
console.error(error);
|
39
|
-
throw error; // 抛出错误以中断 gulp 任务
|
40
|
-
}
|
41
|
-
});
|
42
|
-
|
43
|
-
// 处理样式的配置
|
44
|
-
gulp.task("compile", function () {
|
45
|
-
return gulp
|
46
|
-
.src("./styles/index.scss")
|
47
|
-
.pipe(sass())
|
48
|
-
.pipe(
|
49
|
-
autoprefixer({
|
50
|
-
browsers: ["ie > 9", "last 2 versions"],
|
51
|
-
cascade: false,
|
52
|
-
})
|
53
|
-
)
|
54
|
-
.pipe(cssmin())
|
55
|
-
.pipe(gulp.dest("./lib/"));
|
56
|
-
});
|
57
|
-
|
58
|
-
// 打包文件
|
59
|
-
gulp.task("build", gulp.series(["compile", "webpack"]));
|
60
|
-
|
61
|
-
function debounce(func, wait) {
|
62
|
-
let timeout;
|
63
|
-
|
64
|
-
return function () {
|
65
|
-
let context = this;
|
66
|
-
let args = arguments;
|
67
|
-
|
68
|
-
clearTimeout(timeout);
|
69
|
-
timeout = setTimeout(function () {
|
70
|
-
func.apply(context, args);
|
71
|
-
}, wait);
|
72
|
-
};
|
73
|
-
}
|
74
|
-
|
75
|
-
// 监听文件变化
|
76
|
-
gulp.task("listen", async function () {
|
77
|
-
gulp.watch(["./styles/**"], debounce(gulp.series(["compile"]), 2000));
|
78
|
-
gulp.watch(
|
79
|
-
["./src/**", "./packages/**"],
|
80
|
-
debounce(gulp.series(["webpack"]), 2000)
|
81
|
-
);
|
82
|
-
});
|
83
|
-
|
84
|
-
gulp.task("watch", gulp.series(["compile", "webpack", "listen"]));
|
@@ -1,189 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<el-button
|
3
|
-
v-if="getIsShow() && !attrs.children"
|
4
|
-
:disabled="isDebounce || attrs.disabled"
|
5
|
-
v-bind="attrs"
|
6
|
-
:size="size"
|
7
|
-
:class="b()"
|
8
|
-
@click="handleClick()"
|
9
|
-
>
|
10
|
-
<span v-if="attrs.label">{{ attrs.label }}</span>
|
11
|
-
<slot v-if="$slots.default"></slot>
|
12
|
-
</el-button>
|
13
|
-
<el-dropdown
|
14
|
-
v-else-if="getIsShow()"
|
15
|
-
v-bind="attrs"
|
16
|
-
trigger="click"
|
17
|
-
:size="size"
|
18
|
-
:disabled="isDebounce || attrs.disabled"
|
19
|
-
>
|
20
|
-
<el-button
|
21
|
-
:class="b()"
|
22
|
-
:size="size"
|
23
|
-
:disabled="isDebounce || attrs.disabled"
|
24
|
-
v-bind="attrs"
|
25
|
-
><span v-if="attrs.label">{{ attrs.label }}</span
|
26
|
-
><slot v-if="$slots.default"></slot
|
27
|
-
><i class="el-icon-arrow-down el-icon--right"></i
|
28
|
-
></el-button>
|
29
|
-
<el-dropdown-menu slot="dropdown">
|
30
|
-
<el-dropdown-item
|
31
|
-
v-for="(child, idx) in attrs.children"
|
32
|
-
@click.native="handleClick(child)"
|
33
|
-
:key="idx"
|
34
|
-
v-bind="child"
|
35
|
-
>{{ child.label }}</el-dropdown-item
|
36
|
-
>
|
37
|
-
</el-dropdown-menu>
|
38
|
-
</el-dropdown>
|
39
|
-
</template>
|
40
|
-
<script>
|
41
|
-
import { create } from "core";
|
42
|
-
import { isFunction } from "lodash-es";
|
43
|
-
export default create({
|
44
|
-
inheritAttrs: false,
|
45
|
-
name: "button",
|
46
|
-
props: {
|
47
|
-
time: {
|
48
|
-
type: Number,
|
49
|
-
default: 300,
|
50
|
-
},
|
51
|
-
size: String,
|
52
|
-
scope: {},
|
53
|
-
onClick: {},
|
54
|
-
confirm: {},
|
55
|
-
customConfirm: {},
|
56
|
-
successBack: {},
|
57
|
-
textSubmit: {},
|
58
|
-
batchConfirm: {},
|
59
|
-
},
|
60
|
-
data() {
|
61
|
-
return {
|
62
|
-
isDebounce: false,
|
63
|
-
attrs: {},
|
64
|
-
};
|
65
|
-
},
|
66
|
-
watch: {
|
67
|
-
$attrs() {
|
68
|
-
this.attrs = this.getBindAttrs();
|
69
|
-
},
|
70
|
-
},
|
71
|
-
created() {
|
72
|
-
this.attrs = this.getBindAttrs();
|
73
|
-
},
|
74
|
-
methods: {
|
75
|
-
getBindAttrs() {
|
76
|
-
const attrs = {};
|
77
|
-
Object.keys(this.$attrs).forEach((key) => {
|
78
|
-
if (isFunction(this.$attrs[key])) {
|
79
|
-
attrs[key] = this.$attrs[key](this.scope);
|
80
|
-
} else {
|
81
|
-
attrs[key] = this.$attrs[key];
|
82
|
-
}
|
83
|
-
});
|
84
|
-
return attrs;
|
85
|
-
},
|
86
|
-
getIsShow() {
|
87
|
-
const bindAttrs = this.attrs;
|
88
|
-
if (bindAttrs.hidden) return false;
|
89
|
-
if (bindAttrs.show === false) return false;
|
90
|
-
return true;
|
91
|
-
},
|
92
|
-
handleClick(item = this) {
|
93
|
-
this.beforeClick((...args) => {
|
94
|
-
if (item.onClick) {
|
95
|
-
item.onClick(this.scope, ...args);
|
96
|
-
} else {
|
97
|
-
this.$emit("click", ...args);
|
98
|
-
}
|
99
|
-
this.isDebounce = true;
|
100
|
-
setTimeout(() => {
|
101
|
-
this.isDebounce = false;
|
102
|
-
}, this.time);
|
103
|
-
}, item);
|
104
|
-
},
|
105
|
-
beforeClick(cb, item) {
|
106
|
-
if (item.confirm) {
|
107
|
-
this.handleConfirm(item.confirm, cb);
|
108
|
-
} else if (item.customConfirm) {
|
109
|
-
this.handleCustomConfirm(item.customConfirm, cb);
|
110
|
-
} else if (item.successBack) {
|
111
|
-
this.handleSuccessBack(item.successBack, cb);
|
112
|
-
} else if (item.textSubmit) {
|
113
|
-
this.handleFormSubmit(item.textSubmit, cb);
|
114
|
-
} else if (item.batchConfirm) {
|
115
|
-
this.$scDialog({
|
116
|
-
presetType: "batchConfirm",
|
117
|
-
...item.batchConfirm,
|
118
|
-
}).show(cb);
|
119
|
-
} else {
|
120
|
-
cb();
|
121
|
-
}
|
122
|
-
},
|
123
|
-
handleConfirm(confirm, cb) {
|
124
|
-
if (isFunction(confirm)) confirm = confirm(this.scope);
|
125
|
-
// 处理字符串和布尔值配置
|
126
|
-
if (confirm === true || typeof confirm === "string") {
|
127
|
-
const message = confirm === true ? "确定要执行此操作吗?" : confirm;
|
128
|
-
this.$confirm(message, "提示", {
|
129
|
-
confirmButtonText: "确定",
|
130
|
-
cancelButtonText: "取消",
|
131
|
-
type: "warning",
|
132
|
-
}).then(() => {
|
133
|
-
cb();
|
134
|
-
});
|
135
|
-
return;
|
136
|
-
}
|
137
|
-
// 处理对象配置
|
138
|
-
const {
|
139
|
-
label,
|
140
|
-
title = "提示",
|
141
|
-
confirmButtonText = "确定",
|
142
|
-
cancelButtonText = "取消",
|
143
|
-
type = "warning",
|
144
|
-
} = confirm;
|
145
|
-
this.$confirm(label || "确定要执行此操作吗?", title, {
|
146
|
-
confirmButtonText,
|
147
|
-
cancelButtonText,
|
148
|
-
type,
|
149
|
-
}).then(() => {
|
150
|
-
cb();
|
151
|
-
});
|
152
|
-
},
|
153
|
-
handleCustomConfirm(customConfirm, cb) {
|
154
|
-
if (isFunction(customConfirm)) customConfirm = customConfirm(this.scope);
|
155
|
-
this.$scDialog({
|
156
|
-
presetType: "confirmTip",
|
157
|
-
label: customConfirm.label,
|
158
|
-
content: customConfirm.content,
|
159
|
-
title: customConfirm.title,
|
160
|
-
}).show(cb);
|
161
|
-
},
|
162
|
-
handleSuccessBack(successBack, cb) {
|
163
|
-
const vm = this.$scDialog({
|
164
|
-
presetType: "successBack",
|
165
|
-
onClick: () => {
|
166
|
-
if (isFunction(successBack)) {
|
167
|
-
successBack(this.scope);
|
168
|
-
vm.hide();
|
169
|
-
} else {
|
170
|
-
setTimeout(() => {
|
171
|
-
this.$router.go(-1);
|
172
|
-
vm.hide();
|
173
|
-
}, 50);
|
174
|
-
}
|
175
|
-
},
|
176
|
-
});
|
177
|
-
cb(() => vm.show());
|
178
|
-
},
|
179
|
-
handleFormSubmit(textSubmit, clickCb) {
|
180
|
-
if (isFunction(textSubmit)) textSubmit = textSubmit(this.scope);
|
181
|
-
this.$scDialog({
|
182
|
-
presetType: "textSubmit",
|
183
|
-
...textSubmit,
|
184
|
-
submit: clickCb,
|
185
|
-
}).show();
|
186
|
-
},
|
187
|
-
},
|
188
|
-
});
|
189
|
-
</script>
|