mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 添加lint规则运行脚本,修复lint错误
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
|
||||
/**
|
||||
* * 存储本地会话数据
|
||||
* @param k 键名
|
||||
* @param v 键值(无需stringiiy)
|
||||
* @returns RemovableRef
|
||||
*/
|
||||
export const setLocalStorage = <T>(k: string, v: T) => {
|
||||
export const setLocalStorage = <T>(k: string, v: T) => {
|
||||
try {
|
||||
window.localStorage.setItem(k, JSON.stringify(v))
|
||||
} catch (error) {
|
||||
@@ -18,7 +17,7 @@
|
||||
* @param k 键名
|
||||
* @returns any
|
||||
*/
|
||||
export const getLocalStorage = (k: string) => {
|
||||
export const getLocalStorage = (k: string) => {
|
||||
const item = window.localStorage.getItem(k)
|
||||
try {
|
||||
return item ? JSON.parse(item) : item
|
||||
@@ -29,9 +28,9 @@
|
||||
|
||||
/**
|
||||
* * 清除本地会话数据
|
||||
* @param name
|
||||
* @param name
|
||||
*/
|
||||
export const clearLocalStorage = (name: string) => {
|
||||
export const clearLocalStorage = (name: string) => {
|
||||
window.localStorage.removeItem(name)
|
||||
}
|
||||
|
||||
@@ -64,8 +63,8 @@ export const getSessionStorage: (k: string) => any = (k: string) => {
|
||||
|
||||
/**
|
||||
* * 清除本地会话数据
|
||||
* @param name
|
||||
* @param name
|
||||
*/
|
||||
export const clearSessioStorage = (name: string) => {
|
||||
window.sessionStorage.removeItem(name)
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -135,11 +135,13 @@ export const fileTobase64 = (file: File, callback: Function) => {
|
||||
/**
|
||||
* * 挂载监听
|
||||
*/
|
||||
// eslint-disable-next-line no-undef
|
||||
export const addEventListener = <K extends keyof WindowEventMap>(
|
||||
target: HTMLElement | Document,
|
||||
type: K,
|
||||
listener: any,
|
||||
delay?: number,
|
||||
// eslint-disable-next-line no-undef
|
||||
options?: boolean | AddEventListenerOptions | undefined
|
||||
) => {
|
||||
if (!target) return
|
||||
@@ -156,6 +158,7 @@ export const addEventListener = <K extends keyof WindowEventMap>(
|
||||
/**
|
||||
* * 卸载监听
|
||||
*/
|
||||
// eslint-disable-next-line no-undef
|
||||
export const removeEventListener = <K extends keyof WindowEventMap>(
|
||||
target: HTMLElement | Document,
|
||||
type: K,
|
||||
@@ -245,12 +248,12 @@ export const intervalUnitHandle = (num: number, unit: RequestHttpIntervalEnum) =
|
||||
|
||||
/**
|
||||
* * 对象转换 cookie 格式
|
||||
* @param obj
|
||||
* @param obj
|
||||
* @returns string
|
||||
*/
|
||||
export const objToCookie = (obj: RequestParamsObjType) => {
|
||||
if(!obj) return ''
|
||||
|
||||
if (!obj) return ''
|
||||
|
||||
let str = ''
|
||||
for (const key in obj) {
|
||||
str += key + '=' + obj[key] + ';'
|
||||
|
||||
Reference in New Issue
Block a user