You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
480 B
17 lines
480 B
export function get(name) {
|
|
let arr;
|
|
const reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
|
|
if ((arr = document.cookie.match(reg))) return arr[2];
|
|
else return null;
|
|
}
|
|
|
|
export function set(c_name, value, expiredays) {
|
|
const exdate = new Date();
|
|
exdate.setDate(exdate.getDate() + expiredays);
|
|
document.cookie =
|
|
c_name + '=' + escape(value) + (expiredays == null ? '' : ';expires=' + exdate.toUTCString());
|
|
}
|
|
|
|
export function del(name) {
|
|
set(name, 'a', -1);
|
|
}
|
|
|