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
package/styles/tabs.scss
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
.sc-tabs {
|
2
|
+
// 旋转动画
|
3
|
+
@keyframes rotate {
|
4
|
+
from {
|
5
|
+
transform: rotate(0deg);
|
6
|
+
}
|
7
|
+
to {
|
8
|
+
transform: rotate(360deg);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
// 刷新图标旋转
|
13
|
+
.rotating {
|
14
|
+
animation: rotate 0.45s linear infinite;
|
15
|
+
}
|
16
|
+
|
17
|
+
// tabs内容区域基础样式
|
18
|
+
.sc-tabs__content {
|
19
|
+
position: relative;
|
20
|
+
min-height: 100px;
|
21
|
+
transition: height 0.3s ease-in-out; // 保留过渡动画
|
22
|
+
height: auto; // 默认自适应高度
|
23
|
+
}
|
24
|
+
|
25
|
+
// 标签页面板
|
26
|
+
.tab-pane {
|
27
|
+
position: absolute;
|
28
|
+
left: 0;
|
29
|
+
top: 0;
|
30
|
+
padding: 20px;
|
31
|
+
backface-visibility: hidden;
|
32
|
+
transform-style: preserve-3d;
|
33
|
+
will-change: transform, opacity;
|
34
|
+
|
35
|
+
&.is-active {
|
36
|
+
position: relative; // 激活状态下改为相对定位,使父容器可以正确计算高度
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
// 动画相关样式
|
41
|
+
.fade-transform-enter-active,
|
42
|
+
.fade-transform-leave-active {
|
43
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
44
|
+
position: absolute;
|
45
|
+
left: 0;
|
46
|
+
top: 0;
|
47
|
+
}
|
48
|
+
|
49
|
+
.fade-transform-enter {
|
50
|
+
opacity: 0;
|
51
|
+
transform: translateX(20px);
|
52
|
+
}
|
53
|
+
|
54
|
+
.fade-transform-leave-to {
|
55
|
+
opacity: 0;
|
56
|
+
transform: translateX(-20px);
|
57
|
+
}
|
58
|
+
|
59
|
+
// tabs导航栏底部线条
|
60
|
+
.el-tabs__nav-wrap::after {
|
61
|
+
height: 1px;
|
62
|
+
background-color: var(--border-color-lighter);
|
63
|
+
}
|
64
|
+
|
65
|
+
// 自定义滚动条样式
|
66
|
+
.el-tabs__content {
|
67
|
+
overflow-x: hidden;
|
68
|
+
overflow-y: auto;
|
69
|
+
|
70
|
+
&::-webkit-scrollbar {
|
71
|
+
width: 6px;
|
72
|
+
height: 6px;
|
73
|
+
}
|
74
|
+
|
75
|
+
&::-webkit-scrollbar-thumb {
|
76
|
+
background: var(--border-color-light);
|
77
|
+
border-radius: 3px;
|
78
|
+
}
|
79
|
+
|
80
|
+
&::-webkit-scrollbar-track {
|
81
|
+
background: var(--background-color-light);
|
82
|
+
border-radius: 3px;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
// 带边框的tabs样式
|
88
|
+
.sc-tabs__border {
|
89
|
+
// 移除头部边距
|
90
|
+
.el-tabs__header {
|
91
|
+
margin-bottom: 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
// 移除卡片式tabs的底部边框
|
95
|
+
.el-tabs--card > .el-tabs__header {
|
96
|
+
border-bottom: none;
|
97
|
+
}
|
98
|
+
|
99
|
+
// 内容区域样式
|
100
|
+
.sc-tabs__content {
|
101
|
+
position: relative;
|
102
|
+
overflow: visible;
|
103
|
+
border: 1px solid var(--border-color-lighter);
|
104
|
+
border-radius: 0 4px 4px 4px;
|
105
|
+
background-color: var(--color-white);
|
106
|
+
// box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
107
|
+
|
108
|
+
// 刷新状态移除边框
|
109
|
+
&.sc-tabs__is-refresh {
|
110
|
+
border: none;
|
111
|
+
box-shadow: none;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
// 选项卡样式优化
|
116
|
+
.el-tabs__item {
|
117
|
+
height: 40px;
|
118
|
+
line-height: 40px;
|
119
|
+
color: var(--color-text-regular);
|
120
|
+
|
121
|
+
&.is-active {
|
122
|
+
font-weight: 500;
|
123
|
+
color: var(--color-primary);
|
124
|
+
}
|
125
|
+
|
126
|
+
// 刷新图标
|
127
|
+
.el-icon-refresh {
|
128
|
+
margin-left: 5px;
|
129
|
+
font-size: 14px;
|
130
|
+
cursor: pointer;
|
131
|
+
color: var(--color-text-secondary);
|
132
|
+
transition: color 0.3s;
|
133
|
+
|
134
|
+
&:hover {
|
135
|
+
color: var(--color-primary);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
.sc-verify-input {
|
2
|
+
input {
|
3
|
+
caret-color: transparent;
|
4
|
+
border-radius: 2px;
|
5
|
+
border: 1px solid #eee;
|
6
|
+
text-align: center;
|
7
|
+
transition: border-color 0.3s ease;
|
8
|
+
}
|
9
|
+
|
10
|
+
input::-webkit-outer-spin-button,
|
11
|
+
input::-webkit-inner-spin-button {
|
12
|
+
-webkit-appearance: none;
|
13
|
+
margin: 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
input:valid {
|
17
|
+
border-color: #dcdfe6;
|
18
|
+
}
|
19
|
+
input:focus-visible {
|
20
|
+
outline: none;
|
21
|
+
border-color: var(--color-primary);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.sc-verify-input--mini {
|
26
|
+
input {
|
27
|
+
height: 28px;
|
28
|
+
width: 22px;
|
29
|
+
font-size: 12px;
|
30
|
+
margin: 6px;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
.sc-verify-input--small {
|
34
|
+
input {
|
35
|
+
height: 32px;
|
36
|
+
width: 24px;
|
37
|
+
font-size: 13px;
|
38
|
+
margin: 8px;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
.sc-verify-input--medium {
|
42
|
+
input {
|
43
|
+
height: 36px;
|
44
|
+
width: 28px;
|
45
|
+
font-size: 14px;
|
46
|
+
margin: 10px;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
.sc-verify-input--default {
|
50
|
+
input {
|
51
|
+
height: 40px;
|
52
|
+
width: 32px;
|
53
|
+
font-size: 15px;
|
54
|
+
margin: 11px;
|
55
|
+
}
|
56
|
+
}
|
package/vue-jsx-sync.js
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
let syncRe = /(.*)\_sync/;
|
2
|
+
const camelizeRE = /-(\w)/g;
|
3
|
+
const camelize = (str) => {
|
4
|
+
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ""));
|
5
|
+
};
|
6
|
+
|
7
|
+
var genListener = function genListener(t, event, body) {
|
8
|
+
return t.objectProperty(
|
9
|
+
t.stringLiteral("update:" + event),
|
10
|
+
t.arrowFunctionExpression([t.identifier("$$val")], t.blockStatement(body))
|
11
|
+
);
|
12
|
+
};
|
13
|
+
|
14
|
+
var genAssignmentCode = function genAssignmentCode(t, model) {
|
15
|
+
return t.expressionStatement(
|
16
|
+
t.assignmentExpression("=", model, t.identifier("$$val"))
|
17
|
+
);
|
18
|
+
};
|
19
|
+
|
20
|
+
module.exports = function (babel) {
|
21
|
+
const t = babel.types;
|
22
|
+
|
23
|
+
return {
|
24
|
+
inherits: require("babel-plugin-syntax-jsx"),
|
25
|
+
visitor: {
|
26
|
+
JSXOpeningElement: function (path) {
|
27
|
+
let attrsObject, onObject;
|
28
|
+
|
29
|
+
path.get("attributes").forEach(function (attr) {
|
30
|
+
let matched = attr.node.name.name.match(syncRe);
|
31
|
+
if (matched) {
|
32
|
+
let prop = matched[1];
|
33
|
+
attr.node.name.name = prop;
|
34
|
+
|
35
|
+
let model;
|
36
|
+
|
37
|
+
attr.traverse({
|
38
|
+
JSXExpressionContainer: function (path) {
|
39
|
+
model = path.node.expression;
|
40
|
+
},
|
41
|
+
});
|
42
|
+
|
43
|
+
if (!t.isMemberExpression(model)) {
|
44
|
+
console.error(
|
45
|
+
"You should use MemberExpression with sync modifier, prop [" +
|
46
|
+
prop +
|
47
|
+
"] on node [" +
|
48
|
+
path.node.name.name +
|
49
|
+
"]"
|
50
|
+
);
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
|
54
|
+
// Create attrs object if not already present
|
55
|
+
if (!attrsObject) {
|
56
|
+
attrsObject = t.jSXAttribute(
|
57
|
+
t.jSXIdentifier("attrs"),
|
58
|
+
t.jSXExpressionContainer(t.objectExpression([]))
|
59
|
+
);
|
60
|
+
path.pushContainer("attributes", attrsObject);
|
61
|
+
}
|
62
|
+
|
63
|
+
// Create on object if not already present
|
64
|
+
if (!onObject) {
|
65
|
+
onObject = t.jSXAttribute(
|
66
|
+
t.jSXIdentifier("on"),
|
67
|
+
t.jSXExpressionContainer(t.objectExpression([]))
|
68
|
+
);
|
69
|
+
path.pushContainer("attributes", onObject);
|
70
|
+
}
|
71
|
+
|
72
|
+
// Add the model to the attrs object
|
73
|
+
attrsObject.value.expression.properties.push(
|
74
|
+
t.objectProperty(t.stringLiteral(prop), model)
|
75
|
+
);
|
76
|
+
|
77
|
+
// Generate the listener for the on object
|
78
|
+
let listener = genListener(t, camelize(prop), [
|
79
|
+
genAssignmentCode(t, model),
|
80
|
+
]);
|
81
|
+
onObject.value.expression.properties.push(listener);
|
82
|
+
|
83
|
+
// Remove the original sync attribute
|
84
|
+
attr.remove();
|
85
|
+
}
|
86
|
+
});
|
87
|
+
},
|
88
|
+
},
|
89
|
+
};
|
90
|
+
};
|
package/vue.config.js
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
const path = require("path");
|
2
|
+
function resolve(dir) {
|
3
|
+
return path.join(__dirname, dir);
|
4
|
+
}
|
5
|
+
const alias = require("./build/alias");
|
6
|
+
module.exports = {
|
7
|
+
// transpileDependencies: ['element-ui'], // 解决IE浏览器本地启动白屏现象
|
8
|
+
// outputDir: process.env.outputDir || 'dist', // 输出文件名称
|
9
|
+
// publicPath: './', // 部署应用包时的基本 URL
|
10
|
+
productionSourceMap: true, // 解决vue项目打包后浏览器F12查看到项目源代码false不能看到
|
11
|
+
// productionSourceMap: true, // 测试调试打断点
|
12
|
+
lintOnSave: false, // 去掉eslint校验
|
13
|
+
|
14
|
+
devServer: {
|
15
|
+
port: 1234, // 设置端口号
|
16
|
+
// open: true, // 启动项目自动打开浏览器
|
17
|
+
proxy: {
|
18
|
+
// 解决跨域问题
|
19
|
+
"/api": {
|
20
|
+
target: "http://192.168.4.225:8080 ", // 本地json数据
|
21
|
+
changeOrigin: true,
|
22
|
+
ws: false,
|
23
|
+
pathRewrite: {
|
24
|
+
"^/api": "", // 本地
|
25
|
+
},
|
26
|
+
},
|
27
|
+
},
|
28
|
+
},
|
29
|
+
// 修改 src 目录 为 examples 目录
|
30
|
+
pages: {
|
31
|
+
index: {
|
32
|
+
entry: "examples/main.js",
|
33
|
+
template: "examples/index.html",
|
34
|
+
filename: "index.html",
|
35
|
+
},
|
36
|
+
},
|
37
|
+
// output: {
|
38
|
+
// filename: 'index.js',
|
39
|
+
// path: path.resolve(__dirname, './lib'),
|
40
|
+
// library: '@wocwin/t-ui', // 指定类库名,主要用于直接引用的方式
|
41
|
+
// libraryTarget: 'umd' // 定义打包方式Universal Module Definition,同时支持在CommonJS、AMD和全局变量使用
|
42
|
+
// },
|
43
|
+
// 强制内联CSS
|
44
|
+
css: {
|
45
|
+
extract: false,
|
46
|
+
},
|
47
|
+
configureWebpack: (config) => {
|
48
|
+
config.devtool = "source-map";
|
49
|
+
config.resolve.alias = {
|
50
|
+
...alias,
|
51
|
+
"#": resolve("examples"),
|
52
|
+
};
|
53
|
+
},
|
54
|
+
};
|