# add localStorage

This commit is contained in:
xianfuxing 2018-08-21 10:24:16 +08:00
parent 14919161eb
commit bf5959e40d
1 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ const counter = {
mutations: { mutations: {
CHANGE_DEVICE_ID: (state, deviceID) => { CHANGE_DEVICE_ID: (state, deviceID) => {
state.deviceID = deviceID state.deviceID = deviceID
localStorage.deviceID = deviceID
} }
}, },
actions: { actions: {
@ -14,4 +15,12 @@ const counter = {
} }
} }
try {
if (localStorage.deviceID) {
counter.state.deviceID = localStorage.deviceID
}
} catch (e) {
console.log(e)
}
export default counter export default counter