Skip to content

Commit 555bc5a

Browse files
committed
build: update deps
1 parent 9dab91e commit 555bc5a

File tree

11 files changed

+479
-1015
lines changed

11 files changed

+479
-1015
lines changed

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,52 @@
1616
},
1717
"dependencies": {
1818
"@vant/touch-emulator": "^1.2.0",
19-
"@vueuse/core": "^4.9.1",
20-
"@vueuse/integrations": "^4.9.1",
19+
"@vueuse/core": "^4.9.3",
20+
"@vueuse/integrations": "^4.9.3",
2121
"axios": "^0.21.1",
2222
"dayjs": "^1.10.4",
2323
"dexie": "^3.0.3",
24-
"element-plus": "^1.0.2-beta.41",
24+
"element-plus": "^1.0.2-beta.44",
2525
"lodash": "^4.17.21",
2626
"monaco-editor": "^0.23.0",
2727
"normalize.css": "^8.0.1",
28+
"nprogress": "^1.0.0-1",
2829
"qrcode": "^1.4.4",
2930
"vant": "^3.0.16",
30-
"vue": "^3.0.11",
31+
"vue": "^3.1.0-beta.2",
3132
"vue-router": "^4.0.6",
3233
"vuedraggable": "^4.0.1",
3334
"vuex": "^4.0.0"
3435
},
3536
"devDependencies": {
3637
"@commitlint/cli": "^12.1.1",
3738
"@commitlint/config-conventional": "^12.1.1",
38-
"@types/node": "^14.14.41",
39-
"@typescript-eslint/eslint-plugin": "^4.22.1",
40-
"@typescript-eslint/parser": "^4.22.1",
39+
"@types/node": "^14.14.44",
40+
"@typescript-eslint/eslint-plugin": "^4.23.0",
41+
"@typescript-eslint/parser": "^4.23.0",
4142
"@vitejs/plugin-vue": "^1.2.2",
4243
"@vitejs/plugin-vue-jsx": "^1.1.4",
43-
"@vue/compiler-sfc": "^3.0.11",
44-
"commitizen": "^4.2.3",
44+
"@vue/compiler-sfc": "^3.1.0-beta.2",
45+
"commitizen": "^4.2.4",
4546
"cz-conventional-changelog": "^3.3.0",
4647
"cz-customizable": "^6.3.0",
47-
"eslint": "^7.25.0",
48-
"eslint-config-prettier": "^8.1.0",
48+
"eslint": "^7.26.0",
49+
"eslint-config-prettier": "^8.3.0",
4950
"eslint-plugin-import": "^2.22.1",
5051
"eslint-plugin-prettier": "^3.4.0",
5152
"eslint-plugin-vue": "^7.9.0",
5253
"gh-pages": "^3.1.0",
5354
"husky": "^6.0.0",
5455
"lint-staged": "^10.5.4",
55-
"prettier": "^2.2.1",
56-
"sass": "^1.32.10",
56+
"prettier": "^2.3.0",
57+
"sass": "^1.32.12",
5758
"typescript": "^4.2.4",
58-
"vite": "^2.2.4",
59+
"vite": "2.2.4",
5960
"vite-plugin-components": "^0.9.0",
6061
"vite-plugin-style-import": "^0.10.0",
6162
"vite-plugin-windicss": "^0.16.0-beta.14",
6263
"vue-eslint-parser": "^7.6.0",
63-
"vue-tsc": "^0.1.0",
64+
"vue-tsc": "^0.1.2",
6465
"windicss": "^2.5.14"
6566
},
6667
"repository": {

src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
2-
<visual-editor />
2+
<router-view #="{ Component, route }">
3+
<component :is="Component" :key="route.path" />
4+
</router-view>
35
</template>
46

57
<script lang="ts">
68
import { defineComponent, provide } from 'vue'
7-
import VisualEditor from '@/visual-editor/index.vue'
89
import { initVisualData, injectKey, localKey } from '@/visual-editor/hooks/useVisualData'
910
1011
export default defineComponent({
1112
name: 'App',
12-
components: { VisualEditor },
1313
setup() {
1414
const visualData = initVisualData()
1515
// 注入可视化编辑器所有配置

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ app.config.globalProperties.$$refs = {}
1818
// if (import.meta.env.DEV) {
1919
window.$$refs = app.config.globalProperties.$$refs
2020
// }
21-
22-
app.use(router).use(store).mount('#app')
21+
app.use(router).use(store)
22+
// 路由准备完毕再挂载
23+
router.isReady().then(() => app.mount('#app'))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
createEditorInputNumberProp,
77
createEditorInputProp,
88
createEditorSwitchProp
9-
} from "@/visual-editor/visual-editor.props";
9+
} from '@/visual-editor/visual-editor.props'
1010

1111
export default {
1212
key: 'rate',

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { Field, Stepper } from 'vant'
22
import { VisualEditorComponent } from '@/visual-editor/visual-editor.utils'
33
import { createFieldProps } from './createFieldProps'
44
import { useGlobalProperties } from '@/hooks/useGlobalProperties'
5-
import { createEditorInputNumberProp, createEditorInputProp } from "@/visual-editor/visual-editor.props";
5+
import {
6+
createEditorInputNumberProp,
7+
createEditorInputProp
8+
} from '@/visual-editor/visual-editor.props'
69

710
export default {
811
key: 'stepper',

src/packages/container-component/layout/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
})
5151
}
5252

53-
return (
53+
const RenderLayout = () => (
5454
<Row
5555
ref={(el) => registerRef(el, block._vid)}
5656
{...custom}
@@ -73,6 +73,8 @@ export default {
7373
})}
7474
</Row>
7575
)
76+
77+
return <RenderLayout />
7678
},
7779
resize: {
7880
height: true,

src/router/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
2+
import NProgress from 'nprogress' // progress bar
3+
import 'nprogress/css/nprogress.css' // 进度条样式
24

3-
const routes: Array<RouteRecordRaw> = []
5+
NProgress.configure({ showSpinner: false }) // NProgress Configuration
6+
7+
const routes: Array<RouteRecordRaw> = [
8+
{
9+
path: '/:pathMatch(.*)*',
10+
component: () => import('@/visual-editor/index.vue')
11+
}
12+
]
413

514
const router = createRouter({
615
history: createWebHashHistory(),
716
routes
817
})
918

19+
router.beforeEach(() => {
20+
NProgress.start() // start progress bar
21+
return true
22+
})
23+
24+
router.afterEach(() => {
25+
NProgress.done() // finish progress bar
26+
})
27+
1028
export default router

src/visual-editor/components/left-aside/components/page-tree/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@
6767
<script lang="ts">
6868
import { defineComponent, reactive, computed, toRefs } from 'vue'
6969
import { useVisualData } from '@/visual-editor/hooks/useVisualData'
70-
import { useRouter } from 'vue-router'
70+
import { useRouter, useRoute } from 'vue-router'
7171
7272
export default defineComponent({
7373
name: 'PageTree',
7474
setup() {
7575
const router = useRouter()
76+
const route = useRoute()
7677
7778
const { jsonData, setCurrentPage, deletePage, updatePage, incrementPage } = useVisualData()
7879
@@ -81,7 +82,7 @@ export default defineComponent({
8182
children: 'children',
8283
label: 'title'
8384
},
84-
currentNodeKey: location.hash.slice(1),
85+
currentNodeKey: route.path,
8586
dialogFormVisible: false, // 表单弹窗显隐
8687
operatePageData: null as any, // 当前要增加或修改的页面
8788
form: {

src/visual-editor/hooks/useVisualData.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @description:useVisualData
66
* @update: 2021/5/6 11:59
77
*/
8-
import { reactive, inject, readonly, computed, ComputedRef, DeepReadonly } from 'vue'
8+
import { reactive, inject, readonly, computed, watch, ComputedRef, DeepReadonly } from 'vue'
9+
import { useRoute } from 'vue-router'
910
import {
1011
VisualEditorModelValue,
1112
VisualEditorBlockData,
@@ -55,21 +56,22 @@ export const initVisualData = (): VisualData => {
5556
}
5657
}
5758

59+
const route = useRoute()
60+
5861
console.log('jsonData:', jsonData)
59-
// 获取当前页面哈希路径
60-
const getCurrentPath = () => location.hash.slice(1)
6162
// 所有页面的path都必须以 / 开发
6263
const getPrefixPath = (path: string) => (path.startsWith('/') ? path : `/${path}`)
6364

6465
const state: IState = reactive({
6566
jsonData,
66-
currentPage: jsonData.pages[getCurrentPath()] ?? jsonData.pages['/']
67+
currentPage: jsonData.pages[route.path] ?? jsonData.pages['/']
6768
})
6869

6970
// 路由变化时更新当前操作的页面
70-
window.addEventListener('hashchange', () => {
71-
setCurrentPage(getCurrentPath())
72-
})
71+
watch(
72+
() => route.path,
73+
(url) => setCurrentPage(url)
74+
)
7375

7476
// 更新page
7577
const updatePage = ({ newPath, oldPath, page }) => {

vite.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConfigEnv, defineConfig, loadEnv, UserConfig } from 'vite'
1+
import { ConfigEnv, loadEnv, UserConfig } from 'vite'
22
import vue from '@vitejs/plugin-vue'
33
import vueJsx from '@vitejs/plugin-vue-jsx'
44
import { resolve } from 'path'
@@ -8,10 +8,10 @@ import WindiCSS from 'vite-plugin-windicss'
88

99
const CWD = process.cwd()
1010

11-
// https://vitejs.dev/config/
12-
export default ({ command, mode }: ConfigEnv): UserConfig => {
11+
// https://cn.vitejs.dev/config/
12+
export default ({ mode }: ConfigEnv): UserConfig => {
1313
// 环境变量
14-
const { VITE_BASE_URL, VITE_DROP_CONSOLE } = loadEnv(mode, CWD)
14+
const { VITE_BASE_URL } = loadEnv(mode, CWD)
1515
return {
1616
css: {
1717
modules: {
@@ -23,11 +23,13 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
2323
vueJsx(),
2424
WindiCSS(),
2525
ViteComponents({
26+
// 自动导入组件(还不够完善,可能会有样式丢失)
2627
// valid file extensions for components.
2728
extensions: ['vue', 'tsx'],
2829
customComponentResolvers: [ElementPlusResolver(), VantResolver()]
2930
}),
3031
styleImport({
32+
// 手动导入组件
3133
libs: [
3234
{
3335
libraryName: 'element-plus',

0 commit comments

Comments
 (0)