//设置会过期的localstorage 过期:天
export default {
	set: function(key, value, expired) {
		window.localStorage.setItem(key, JSON.stringify({
			value: JSON.stringify(value),
			expire: Date.now() + 1000*60*60*24 * expired
		}))
	},
	get: function(key) {
		let obj  = window.localStorage.getItem(key) || '';
		if(obj) {
			const { value,expire } = JSON.parse(obj);
			if ( Date.now() >= expire ) {
				window.localStorage.removeItem(key);
				return [];
			}

			return JSON.parse(value);
		}
	}
}
