Skip to content

Commit 65493e1

Browse files
committed
fix: some bug
1 parent 25b3d69 commit 65493e1

40 files changed

+847
-806
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@
3232
目前在使用表单时,需要把相关的`表单控件`放到`表单容器`内部,并且需要将`按钮`放到`表单容器`内,
3333
然后再讲`按钮的type`设置为`表单提交按钮`这时候点击提交按钮才会自动收集表单容器内部的所有字段和值
3434

35+
### 快速生成组件属性
36+
37+
```javascript
38+
// 在vant文档中 chrome控制台输入以下代码,快速生成组件属性
39+
let propObj = {
40+
string: (config) => `createEditorInputProp(${JSON.stringify(config)})`,
41+
number: (config) => `createEditorInputNumberProp(${JSON.stringify(config)})`,
42+
boolean: (config) => `createEditorSwitchProp(${JSON.stringify(config)})`
43+
}
44+
45+
$$('#props + table tr').reduce((prev, curr) => {
46+
const children = curr.children
47+
const key = children[0].textContent.replace(/-([a-z])/g, (all, i) => i.toUpperCase())
48+
const value = (propObj[children[2].textContent] ?? propObj['string'])({
49+
label: `'${children[1].textContent}'`
50+
}).replaceAll('"', '')
51+
prev[key] = value
52+
return prev
53+
}, {})
54+
```
55+
3556
## 浏览器支持
3657
3758
本地开发推荐使用`Chrome 80+` 浏览器

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,34 @@
2020
"prepare": "husky install"
2121
},
2222
"dependencies": {
23-
"@vant/touch-emulator": "^1.2.0",
23+
"@vant/touch-emulator": "^1.3.0",
2424
"@vueuse/core": "^4.11.1",
2525
"@vueuse/integrations": "^4.11.1",
2626
"axios": "^0.21.1",
2727
"dayjs": "^1.10.4",
2828
"dexie": "^3.0.3",
29-
"element-plus": "^1.0.2-beta.44",
29+
"element-plus": "^1.0.2-beta.45",
3030
"lodash": "^4.17.21",
3131
"monaco-editor": "^0.24.0",
3232
"normalize.css": "^8.0.1",
3333
"nprogress": "^1.0.0-1",
3434
"qrcode": "^1.4.4",
3535
"vant": "^3.0.17",
36-
"vue": "^3.1.0-beta.4",
36+
"vue": "3.0.11",
3737
"vue-router": "^4.0.8",
3838
"vuedraggable": "^4.0.1",
3939
"vuex": "^4.0.1"
4040
},
4141
"devDependencies": {
4242
"@commitlint/cli": "^12.1.4",
4343
"@commitlint/config-conventional": "^12.1.4",
44-
"@types/node": "^14.17.1",
44+
"@types/node": "^15.6.1",
4545
"@typescript-eslint/eslint-plugin": "^4.25.0",
4646
"@typescript-eslint/parser": "^4.25.0",
4747
"@vitejs/plugin-legacy": "^1.4.0",
4848
"@vitejs/plugin-vue": "^1.2.2",
4949
"@vitejs/plugin-vue-jsx": "^1.1.4",
50-
"@vue/compiler-sfc": "^3.1.0-beta.4",
50+
"@vue/compiler-sfc": "3.0.11",
5151
"commitizen": "^4.2.4",
5252
"cz-conventional-changelog": "^3.3.0",
5353
"cz-customizable": "^6.3.0",
@@ -56,24 +56,24 @@
5656
"eslint-plugin-import": "^2.23.3",
5757
"eslint-plugin-prettier": "^3.4.0",
5858
"eslint-plugin-vue": "^7.9.0",
59-
"gh-pages": "^3.1.0",
59+
"gh-pages": "^3.2.0",
6060
"husky": "^6.0.0",
61-
"lint-staged": "^10.5.4",
61+
"lint-staged": "^11.0.0",
6262
"prettier": "^2.3.0",
6363
"pretty-quick": "^3.1.0",
64-
"sass": "1.32.13",
64+
"sass": "1.34.0",
6565
"stylelint": "^13.13.1",
6666
"stylelint-config-prettier": "^8.0.2",
6767
"stylelint-config-standard": "^22.0.0",
6868
"stylelint-order": "^4.1.0",
69-
"typescript": "^4.2.4",
69+
"typescript": "^4.3.2",
7070
"vite": "2.3.4",
71-
"vite-plugin-components": "^0.10.2",
71+
"vite-plugin-components": "^0.10.3",
7272
"vite-plugin-style-import": "^0.10.1",
73-
"vite-plugin-windicss": "^0.16.0",
73+
"vite-plugin-windicss": "^0.16.7",
7474
"vue-eslint-parser": "^7.6.0",
7575
"vue-tsc": "^0.1.6",
76-
"windicss": "^2.5.14"
76+
"windicss": "^3.0.12"
7777
},
7878
"repository": {
7979
"type": "git",

preview/main.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import App from './App.vue'
33

44
import router from './router'
55

6-
import '@/plugins/vant'
6+
import { setupVant } from '@/plugins/vant'
77

88
const app = createApp(App)
99

10+
// 安装vant插件
11+
setupVant(app)
12+
1013
app.config.globalProperties.$$refs = {}
1114

1215
// if (import.meta.env.DEV) {

preview/views/preview.vue

+1-18
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,9 @@ export default defineComponent({
4444
router.replace('/')
4545
}
4646
47-
// 渲染组件
48-
const renderCom = (element) => {
49-
if (Array.isArray(element)) {
50-
return element.map((item) => renderCom(item))
51-
}
52-
const component = visualConfig.componentMap[element.componentKey]
53-
54-
return component.render({
55-
size: {},
56-
props: element.props || {},
57-
block: element,
58-
model: {},
59-
custom: {}
60-
})
61-
}
62-
6347
return {
6448
...toRefs(state),
65-
visualConfig,
66-
renderCom
49+
visualConfig
6750
}
6851
}
6952
})

src/main.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createApp } from 'vue'
22
import App from './App.vue'
33

44
import './plugins/element-plus'
5-
import './plugins/vant'
5+
import { setupVant } from './plugins/vant'
66

77
import 'normalize.css'
88
import 'virtual:windi.css'
@@ -13,6 +13,9 @@ import store from './store/'
1313

1414
const app = createApp(App)
1515

16+
// 使用vant插件
17+
setupVant(app)
18+
1619
app.config.globalProperties.$$refs = {}
1720

1821
// if (import.meta.env.DEV) {

src/packages/base-widgets/button/index.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ export default {
3737
options: [
3838
{
3939
label: '主要按钮',
40-
val: 'primary'
40+
value: 'primary'
4141
},
4242
{
4343
label: '成功按钮',
44-
val: 'success'
44+
value: 'success'
4545
},
4646
{
4747
label: '默认按钮',
48-
val: 'default'
48+
value: 'default'
4949
},
5050
{
5151
label: '警告按钮',
52-
val: 'warning'
52+
value: 'warning'
5353
},
5454
{
5555
label: '危险按钮',
56-
val: 'danger'
56+
value: 'danger'
5757
}
5858
],
5959
defaultValue: 'default'
@@ -63,30 +63,30 @@ export default {
6363
options: [
6464
{
6565
label: '大型',
66-
val: 'large'
66+
value: 'large'
6767
},
6868
{
6969
label: '普通',
70-
val: 'normal'
70+
value: 'normal'
7171
},
7272
{
7373
label: '小型',
74-
val: 'small'
74+
value: 'small'
7575
},
7676
{
7777
label: '迷你',
78-
val: 'mini'
78+
value: 'mini'
7979
}
8080
],
8181
defaultValue: 'normal'
8282
}),
8383
'native-type': createEditorSelectProp({
8484
label: '原生button的type属性',
8585
options: [
86-
{ label: '普通button', val: 'button' },
86+
{ label: '普通button', value: 'button' },
8787
{
8888
label: '表单提交按钮',
89-
val: 'submit'
89+
value: 'submit'
9090
}
9191
],
9292
defaultValue: 'button'
@@ -110,11 +110,11 @@ export default {
110110
options: [
111111
{
112112
label: '左侧',
113-
val: 'left'
113+
value: 'left'
114114
},
115115
{
116116
label: '右侧',
117-
val: 'right'
117+
value: 'right'
118118
}
119119
]
120120
}),
@@ -128,8 +128,8 @@ export default {
128128
'loading-type': createEditorSelectProp({
129129
label: '加载图标类型',
130130
options: [
131-
{ label: 'circular', val: 'circular' },
132-
{ label: 'spinner', val: 'spinner' }
131+
{ label: 'circular', value: 'circular' },
132+
{ label: 'spinner', value: 'spinner' }
133133
],
134134
defaultValue: 'circular'
135135
})

src/packages/base-widgets/checkbox/createFieldProps.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export const createFieldProps = () => ({
1919
options: [
2020
{
2121
label: '左对齐',
22-
val: 'left'
22+
value: 'left'
2323
},
2424
{
2525
label: '居中',
26-
val: 'center'
26+
value: 'center'
2727
},
2828
{
2929
label: '右对齐',
30-
val: 'right'
30+
value: 'right'
3131
}
3232
],
3333
defaultValue: 'left'

src/packages/base-widgets/checkbox/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ export default {
5454
modelValue: createEditorSelectProp({
5555
label: '默认值',
5656
options: [
57-
{ label: '萝卜', val: 'radish' },
58-
{ label: '青菜', val: 'greens' }
57+
{ label: '萝卜', value: 'radish' },
58+
{ label: '青菜', value: 'greens' }
5959
],
6060
multiple: true,
6161
defaultValue: []
6262
}),
63-
name: createEditorInputProp({ label: '名称,提交表单的标识符', defaultValue: 'checkbox' }),
63+
name: createEditorInputProp({ label: '字段名', defaultValue: 'checkbox' }),
6464
label: createEditorInputProp({ label: '输入框左侧文本', defaultValue: '复选框' }),
6565
options: createEditorTableProp({
6666
label: '默认选项',
@@ -82,11 +82,11 @@ export default {
8282
options: [
8383
{
8484
label: '水平',
85-
val: 'horizontal'
85+
value: 'horizontal'
8686
},
8787
{
8888
label: '垂直',
89-
val: 'vertical'
89+
value: 'vertical'
9090
}
9191
],
9292
defaultValue: 'horizontal'

src/packages/base-widgets/datetimePicker/createFieldProps.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export const createFieldProps = () => ({
1919
options: [
2020
{
2121
label: '左对齐',
22-
val: 'left'
22+
value: 'left'
2323
},
2424
{
2525
label: '居中',
26-
val: 'center'
26+
value: 'center'
2727
},
2828
{
2929
label: '右对齐',
30-
val: 'right'
30+
value: 'right'
3131
}
3232
],
3333
defaultValue: 'left'

0 commit comments

Comments
 (0)