Merge pull request 'app-main增加移动端适配padding' (#2) from soul2/views into develop
Reviewed-on: soul2-demo-module/cn-soul2-web#2develop
commit
f000c09256
7 changed files with 108 additions and 37 deletions
@ -1,5 +1,18 @@ |
||||
const getters = { |
||||
routes: state => state.menu.routes |
||||
routes: state => state.menu.routes, |
||||
screenWidth: state => state.screen.screenWidth, |
||||
screenPadding: state => { |
||||
let width = state.screen.screenWidth |
||||
if (width >= 600) { |
||||
if (width >= 1000) { |
||||
return {paddingLeft: '15%', paddingRight: '15%'} |
||||
} else { |
||||
return {paddingLeft: '5%', paddingRight: '5%'} |
||||
} |
||||
} else { |
||||
return {} |
||||
} |
||||
} |
||||
} |
||||
|
||||
export default getters |
||||
|
@ -0,0 +1,19 @@ |
||||
const state = { |
||||
screenWidth: document.body.clientWidth |
||||
} |
||||
|
||||
const mutations = { |
||||
UPDATE_SCREEN_WIDTH(state, value) { |
||||
state.screenWidth = value |
||||
console.log('run update screen width') |
||||
} |
||||
} |
||||
|
||||
const actions = {} |
||||
|
||||
export default { |
||||
namespaced: true, |
||||
state, |
||||
mutations, |
||||
actions |
||||
} |
Loading…
Reference in new issue