From 8787c5d5b784f03e4ffe8813458a64a0c01b3a7f Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sat, 27 Feb 2021 00:31:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=81UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/styles/antd.scss | 2 - src/components/ColorPicker/index.vue | 2 +- src/store/actions.ts | 20 ++++----- src/utils/database.ts | 2 +- .../Editor/Canvas/ElementCreateSelection.vue | 5 ++- ...eBackground.vue => ViewportBackground.vue} | 6 +-- src/views/Editor/Canvas/index.vue | 6 +-- src/views/Editor/EditorHeader/index.vue | 45 +++++++++++++------ .../ElementStylePanel/ImageStylePanel.vue | 2 +- 9 files changed, 54 insertions(+), 36 deletions(-) rename src/views/Editor/Canvas/{SlideBackground.vue => ViewportBackground.vue} (91%) diff --git a/src/assets/styles/antd.scss b/src/assets/styles/antd.scss index af33e3cd..d9dc2405 100644 --- a/src/assets/styles/antd.scss +++ b/src/assets/styles/antd.scss @@ -21,10 +21,8 @@ } .ant-dropdown-menu { box-shadow: $boxShadow; - border: 1px solid $borderColor; } .ant-dropdown-menu-item { - transition: none; &:hover { background-color: rgba($color: $themeColor, $alpha: .2); diff --git a/src/components/ColorPicker/index.vue b/src/components/ColorPicker/index.vue index f363787a..f262bb75 100644 --- a/src/components/ColorPicker/index.vue +++ b/src/components/ColorPicker/index.vue @@ -57,7 +57,7 @@ > -
最近使用:
+
最近使用:
= { async [ActionTypes.INIT_SNAPSHOT_DATABASE]({ commit, state }) { - const snapshots: Snapshot[] = await db.snapshots.orderBy('id').toArray() + const snapshots: Snapshot[] = await snapshotDB.snapshots.orderBy('id').toArray() const lastSnapshot = snapshots.slice(-1)[0] if (lastSnapshot) { - db.snapshots.clear() + snapshotDB.snapshots.clear() } const newFirstSnapshot = { index: state.slideIndex, slides: state.slides, } - await db.snapshots.add(newFirstSnapshot) + await snapshotDB.snapshots.add(newFirstSnapshot) commit(MutationTypes.SET_SNAPSHOT_CURSOR, 0) commit(MutationTypes.SET_SNAPSHOT_LENGTH, 1) }, async [ActionTypes.ADD_SNAPSHOT]({ state, commit }) { - const allKeys = await db.snapshots.orderBy('id').keys() + const allKeys = await snapshotDB.snapshots.orderBy('id').keys() let needDeleteKeys: IndexableTypeArray = [] @@ -35,7 +35,7 @@ export const actions: ActionTree = { index: state.slideIndex, slides: state.slides, } - await db.snapshots.add(snapshot) + await snapshotDB.snapshots.add(snapshot) let snapshotLength = allKeys.length - needDeleteKeys.length + 1 @@ -44,10 +44,10 @@ export const actions: ActionTree = { snapshotLength-- } if (snapshotLength >= 2) { - db.snapshots.update(allKeys[snapshotLength - 2] as number, { index: state.slideIndex }) + snapshotDB.snapshots.update(allKeys[snapshotLength - 2] as number, { index: state.slideIndex }) } - await db.snapshots.bulkDelete(needDeleteKeys) + await snapshotDB.snapshots.bulkDelete(needDeleteKeys) commit(MutationTypes.SET_SNAPSHOT_CURSOR, snapshotLength - 1) commit(MutationTypes.SET_SNAPSHOT_LENGTH, snapshotLength) @@ -57,7 +57,7 @@ export const actions: ActionTree = { if (state.snapshotCursor <= 0) return const snapshotCursor = state.snapshotCursor - 1 - const snapshots: Snapshot[] = await db.snapshots.orderBy('id').toArray() + const snapshots: Snapshot[] = await snapshotDB.snapshots.orderBy('id').toArray() const snapshot = snapshots[snapshotCursor] const { index, slides } = snapshot @@ -71,7 +71,7 @@ export const actions: ActionTree = { if (state.snapshotCursor >= state.snapshotLength - 1) return const snapshotCursor = state.snapshotCursor + 1 - const snapshots: Snapshot[] = await db.snapshots.orderBy('id').toArray() + const snapshots: Snapshot[] = await snapshotDB.snapshots.orderBy('id').toArray() const snapshot = snapshots[snapshotCursor] const { index, slides } = snapshot diff --git a/src/utils/database.ts b/src/utils/database.ts index 5f3955fe..2afc254f 100644 --- a/src/utils/database.ts +++ b/src/utils/database.ts @@ -18,4 +18,4 @@ class SnapshotDatabase extends Dexie { } } -export default new SnapshotDatabase() \ No newline at end of file +export const snapshotDB = new SnapshotDatabase() \ No newline at end of file diff --git a/src/views/Editor/Canvas/ElementCreateSelection.vue b/src/views/Editor/Canvas/ElementCreateSelection.vue index 66a20fa3..2dcfc78c 100644 --- a/src/views/Editor/Canvas/ElementCreateSelection.vue +++ b/src/views/Editor/Canvas/ElementCreateSelection.vue @@ -15,7 +15,7 @@ > \ No newline at end of file diff --git a/src/views/Editor/Canvas/SlideBackground.vue b/src/views/Editor/Canvas/ViewportBackground.vue similarity index 91% rename from src/views/Editor/Canvas/SlideBackground.vue rename to src/views/Editor/Canvas/ViewportBackground.vue index f8934ab6..8d3beb41 100644 --- a/src/views/Editor/Canvas/SlideBackground.vue +++ b/src/views/Editor/Canvas/ViewportBackground.vue @@ -1,6 +1,6 @@