From 279f414db068a6c11b1be164d28090ef6508f6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 13 Jan 2023 15:54:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20=E8=B0=83=E6=8D=A2=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=AF=BC=E5=87=BA=E7=9A=84=20logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentEdit/components/EditTools/index.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/chart/ContentEdit/components/EditTools/index.vue b/src/views/chart/ContentEdit/components/EditTools/index.vue index fc435ad2..79d2eb6c 100644 --- a/src/views/chart/ContentEdit/components/EditTools/index.vue +++ b/src/views/chart/ContentEdit/components/EditTools/index.vue @@ -172,18 +172,18 @@ const updateToSession = (id: string) => { // 配置列表 const btnList: BtnListType[] = [ - { - key: 'export', - type: TypeEnum.BUTTON, - name: '导出', - icon: ShareIcon, - handle: exportHandle - }, { key: 'import', type: TypeEnum.IMPORTUPLOAD, name: '导入', - icon: DownloadIcon + icon: ShareIcon + }, + { + key: 'export', + type: TypeEnum.BUTTON, + name: '导出', + icon: DownloadIcon, + handle: exportHandle }, { key: 'edit', From cbf541282ae47c9836aff395ec8d3ab862fd899c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 13 Jan 2023 16:14:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E5=BA=8F=E5=88=97=E5=8C=96=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/storage.ts | 6 ++++-- src/utils/utils.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/storage.ts b/src/utils/storage.ts index d55d33bd..0cc733f0 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -1,3 +1,5 @@ +import { JSONStringify, JSONParse } from './utils' + /** * * 存储本地会话数据 * @param k 键名 @@ -6,7 +8,7 @@ */ export const setLocalStorage = (k: string, v: T) => { try { - window.localStorage.setItem(k, JSON.stringify(v)) + window.localStorage.setItem(k, JSONStringify(v)) } catch (error) { return false } @@ -20,7 +22,7 @@ export const setLocalStorage = (k: string, v: T) => { export const getLocalStorage = (k: string) => { const item = window.localStorage.getItem(k) try { - return item ? JSON.parse(item) : item + return item ? JSONParse(item) : item } catch (err) { return item } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 0a123db3..858ac9c3 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -295,7 +295,7 @@ export const setKeyboardDressShow = (keyCode?: number) => { * * JSON序列化,支持函数和 undefined * @param data */ -export const JSONStringify = (data: object) => { +export const JSONStringify = (data: T) => { return JSON.stringify( data, (key, val) => {