var expiresDate= new Date(); expiresDate.setTime(expiresDate.getTime() + (120*60*1000)); $.cookie('username', res.data.username, { expires: expiresDate, path: '/' });
cookie缓存2小时写法