Merge branch 'dev' into master-fetch-dev

This commit is contained in:
奔跑的面条 2023-01-13 16:15:09 +08:00
commit 661b3570a5
3 changed files with 13 additions and 11 deletions

View File

@ -1,3 +1,5 @@
import { JSONStringify, JSONParse } from './utils'
/** /**
* * * *
* @param k * @param k
@ -6,7 +8,7 @@
*/ */
export const setLocalStorage = <T>(k: string, v: T) => { export const setLocalStorage = <T>(k: string, v: T) => {
try { try {
window.localStorage.setItem(k, JSON.stringify(v)) window.localStorage.setItem(k, JSONStringify(v))
} catch (error) { } catch (error) {
return false return false
} }
@ -20,7 +22,7 @@ export const setLocalStorage = <T>(k: string, v: T) => {
export const getLocalStorage = (k: string) => { export const getLocalStorage = (k: string) => {
const item = window.localStorage.getItem(k) const item = window.localStorage.getItem(k)
try { try {
return item ? JSON.parse(item) : item return item ? JSONParse(item) : item
} catch (err) { } catch (err) {
return item return item
} }

View File

@ -272,7 +272,7 @@ export const setKeyboardDressShow = (keyCode?: number) => {
* * JSON序列化 undefined * * JSON序列化 undefined
* @param data * @param data
*/ */
export const JSONStringify = (data: object) => { export const JSONStringify = <T>(data: T) => {
return JSON.stringify( return JSON.stringify(
data, data,
(key, val) => { (key, val) => {

View File

@ -172,18 +172,18 @@ const updateToSession = (id: string) => {
// //
const btnList: BtnListType[] = [ const btnList: BtnListType[] = [
{
key: 'export',
type: TypeEnum.BUTTON,
name: '导出',
icon: ShareIcon,
handle: exportHandle
},
{ {
key: 'import', key: 'import',
type: TypeEnum.IMPORTUPLOAD, type: TypeEnum.IMPORTUPLOAD,
name: '导入', name: '导入',
icon: DownloadIcon icon: ShareIcon
},
{
key: 'export',
type: TypeEnum.BUTTON,
name: '导出',
icon: DownloadIcon,
handle: exportHandle
}, },
{ {
key: 'edit', key: 'edit',