12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- const state = () => ({
- isPc: true,
- screen: 'pc',
- static: `${process.env.STATIC_URL}/pc`,
- loginVisiable: false,
- routePrefix: '', // 路由前缀
- themeName: 'normal',
- screenWidth: 0,
- })
- 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
- },
- }
- const actions = {}
- export default {
- namespaced: true,
- state,
- mutations,
- actions,
- }
|