parent
84c0882de1
commit
36e6c6a385
5 changed files with 119 additions and 18 deletions
@ -0,0 +1,36 @@ |
||||
<template> |
||||
<div class="menu-child"> |
||||
<template v-for="item in this.menuList"> |
||||
<el-submenu :popper-class="$route.path === '/home' || $route.path === '/sfel' ? 'home-menu-popup' : ''" :class="{active: $route.query.id == item.id}" :key="item.id" :index="String(item.id)" :id="item.id" v-if="item.children && item.children.length"> |
||||
<template slot="title"> |
||||
<span slot="title" :id="item.id">{{item.columnName}}</span> |
||||
</template> |
||||
<!-- <menuTree :menuList="item.children"></menuTree> --> |
||||
</el-submenu> |
||||
<el-menu-item :key="item.id" :id="item.id" :index="String(item.id)" :class="{active: $route.query.id == item.id}" v-else> |
||||
<span slot="title" :id="item.id">{{item.columnName}}</span> |
||||
</el-menu-item> |
||||
</template> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'menuTree', |
||||
props: { |
||||
menuList: { |
||||
type: Array, |
||||
default: [] |
||||
} |
||||
}, |
||||
data () { |
||||
return {} |
||||
}, |
||||
mounted () {}, |
||||
methods: {} |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
||||
|
@ -1,2 +1,4 @@ |
||||
const getters = {}; |
||||
const getters = { |
||||
getModelType:(state) => state.modelType |
||||
}; |
||||
export default getters; |
@ -1,25 +1,34 @@ |
||||
import Vue from "vue"; |
||||
import Vuex from "vuex"; |
||||
import getters from "./getters"; |
||||
import Vue from 'vue'; |
||||
import Vuex from 'vuex'; |
||||
import getters from './getters'; |
||||
|
||||
Vue.use(Vuex); |
||||
|
||||
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
||||
const modulesFiles = require.context("./modules", true, /\.js$/); |
||||
const modulesFiles = require.context('./modules', true, /\.js$/); |
||||
|
||||
// you do not need `import app from './modules/app'`
|
||||
// it will auto require all vuex module from modules file
|
||||
const modules = modulesFiles.keys().reduce((modules, modulePath) => { |
||||
// set './app.js' => 'app'
|
||||
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1"); |
||||
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1'); |
||||
const value = modulesFiles(modulePath); |
||||
modules[moduleName] = value.default; |
||||
return modules; |
||||
}, {}); |
||||
|
||||
const store = new Vuex.Store({ |
||||
state: { |
||||
modelType: false //true为PC端,false为手机端
|
||||
}, |
||||
mutations: { |
||||
updateModelType(state, type) { |
||||
console.log(state) |
||||
state.modelType = type; |
||||
} |
||||
}, |
||||
modules, |
||||
getters |
||||
}); |
||||
|
||||
export default store; |
||||
export default store; |
||||
|
Loading…
Reference in new issue