完善定位功能
This commit is contained in:
@ -47,7 +47,11 @@ const mutations = {
|
||||
SETCONFIG(state, data) {
|
||||
state.config = Object.assign(state.config, data)
|
||||
Cache.set(CONFIG, state.config);
|
||||
}
|
||||
},
|
||||
|
||||
SETSYSTEMINFO(state, data) {
|
||||
state.sysInfo = data
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {
|
||||
@ -82,6 +86,34 @@ const actions = {
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
getSystemInfo({
|
||||
state,
|
||||
commit
|
||||
}) {
|
||||
uni.getSystemInfo({
|
||||
success: res => {
|
||||
let {
|
||||
statusBarHeight,
|
||||
platform,
|
||||
} = res;
|
||||
let navHeight;
|
||||
if (platform == 'ios' || platform == 'devtools') {
|
||||
navHeight = statusBarHeight + 44;
|
||||
} else {
|
||||
navHeight = statusBarHeight + 48;
|
||||
}
|
||||
commit('SETSYSTEMINFO', {
|
||||
...res,
|
||||
navHeight,
|
||||
})
|
||||
console.log(state)
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user