Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maple
TOSTUMI
Commits
8ad873b9
Commit
8ad873b9
authored
Jan 19, 2021
by
Sixiang_Zzb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复记住密码存储时间bug
parent
a329cf87
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
method.ts
src/utils/method.ts
+10
-10
No files found.
src/utils/method.ts
View file @
8ad873b9
...
...
@@ -48,17 +48,17 @@ export const getCookie = (key: string) => {
return
''
;
};
/**
* @param key 名字
* @param value 值
* @param time 存储时间
*/
export
const
setCookie
=
(
key
:
string
,
value
:
string
,
time
?:
number
)
=>
{
let
expires
:
string
;
// 是否传入缓存时间
if
(
time
)
{
expires
=
"expores="
+
time
;
}
else
{
const
d
=
new
Date
();
// cookie 设置时间,防止刷新就丢失
var
d
=
new
Date
();
d
.
setTime
(
d
.
getTime
()
+
1
*
24
*
60
*
60
*
1000
);
expires
=
'expires='
+
d
.
toUTCString
();
}
d
.
setTime
(
d
.
getTime
()
+
(
time
||
1
)
*
24
*
60
*
60
*
1000
);
let
expires
=
'expires='
+
d
.
toUTCString
();
document
.
cookie
=
key
+
'='
+
value
+
'; '
+
expires
+
';path=/'
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment