-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
159 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<template> | ||
<div class=""></div> | ||
<div class=""> | ||
[WIP] | ||
</div> | ||
</template> | ||
|
||
<script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import jsCookie from 'js-cookie' | ||
|
||
/** | ||
* 操作 Cookie | ||
* @method set 设置 | ||
* @method get 获取 | ||
* @method remove 移除 | ||
* @method clear 移除全部 | ||
*/ | ||
export default { | ||
// 设置 | ||
set(key, val) { | ||
jsCookie.set(key, JSON.stringify(val)) | ||
}, | ||
// 获取 | ||
get(key) { | ||
const json = jsCookie.get(key) | ||
try { | ||
return JSON.parse(json) | ||
} | ||
catch (error) { | ||
return json | ||
} | ||
}, | ||
// 移除 | ||
remove(key) { | ||
jsCookie.remove(key) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import defaultStorage from './localStorage' | ||
|
||
// export { default as localStorage } from './localStorage' | ||
// export { default as sessionStorage } from './sessionStorage' | ||
// export { default as cookieStorage } from './cookieStorage' | ||
|
||
export default defaultStorage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* window.localStorage | ||
* @method set 设置 | ||
* @method get 获取 | ||
* @method remove 移除 | ||
* @method clear 移除全部 | ||
*/ | ||
export default { | ||
// 设置 | ||
set(key, val) { | ||
window.localStorage.setItem(key, JSON.stringify(val)) | ||
}, | ||
// 获取 | ||
get(key) { | ||
const json = window.localStorage.getItem(key) | ||
try { | ||
return JSON.parse(json) | ||
} | ||
catch (error) { | ||
return json | ||
} | ||
}, | ||
// 移除 | ||
remove(key) { | ||
window.localStorage.removeItem(key) | ||
}, | ||
// 移除全部 | ||
clear() { | ||
window.localStorage.clear() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* window.sessionStorage | ||
* @method set 设置 | ||
* @method get 获取 | ||
* @method remove 移除 | ||
* @method clear 移除全部 | ||
*/ | ||
export default { | ||
// 设置 | ||
set(key, val) { | ||
window.sessionStorage.setItem(key, JSON.stringify(val)) | ||
}, | ||
// 获取 | ||
get(key) { | ||
const json = window.sessionStorage.getItem(key) | ||
try { | ||
return JSON.parse(json) | ||
} | ||
catch (error) { | ||
return json | ||
} | ||
}, | ||
// 移除 | ||
remove(key) { | ||
window.sessionStorage.removeItem(key) | ||
}, | ||
// 移除全部 | ||
clear() { | ||
window.sessionStorage.clear() | ||
}, | ||
} |