1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- const state = () => ({
- isPc: true,
- screen: 'pc',
- static: `${process.env.STATIC_URL}/pc`,
- loginVisiable: false,
- routePrefix: '', // 路由前缀
- themeName: 'normal',
- screenWidth: 0,
- showHeader: true,
- showFooter: true,
- accessToken: '',
- wxConfig: {},
- })
- const mutations = {
- SET_SCREEN(state, width) {
- if (width > 768) {
- state.isPc = true
- state.screen = 'pc'
- } else {
- state.isPc = false
- state.screen = 'h5'
- }
- state.screenWidth = width
- state.static = `${process.env.STATIC_URL}/${state.screen}`
- },
- SHOW_LOGIN(state) {
- state.loginVisiable = true
- },
- HIDE_LOGIN(state) {
- state.loginVisiable = false
- },
- // 供应商模板类型
- SET_ROUTE_PREFIX(state, prefix) {
- state.routePrefix = prefix
- },
- // 设置主题
- SET_PAGE_THEME(state, name) {
- state.themeName = name
- },
- // hide layout
- HIDE_LAYOUT(state) {
- state.showHeader = false
- state.showFooter = false
- },
- SHOW_LAYOUT(state) {
- state.showHeader = true
- state.showFooter = true
- },
- SET_WXCONFIG(state, config) {
- state.wxConfig = config
- },
- }
- const actions = {}
- export default {
- namespaced: true,
- state,
- mutations,
- actions,
- }
|