refactor: 小修改

pull/67/head
xiaojunnuo 2020-12-02 17:03:58 +08:00
parent c18a5ccc25
commit cf2ac9b4de
2 changed files with 23 additions and 14 deletions

View File

@ -45,31 +45,20 @@
</template> </template>
<script> <script>
import createMenus from '@/view/router/menu'
export default { export default {
name: 'App', name: 'App',
components: { components: {
}, },
data () { data () {
return { return {
menus: [ menus: undefined
{ title: '首页', path: '/index', icon: 'home' },
{ title: '加速服务', path: '/server', icon: 'thunderbolt' },
{ title: '系统代理', path: '/proxy', icon: 'deployment-unit' },
{
title: '应用',
path: '/plugin',
icon: 'api',
children: [
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' },
{ title: '功能增强', path: '/plugin/overwall', icon: 'global' }
]
}
]
} }
}, },
computed: { computed: {
}, },
created () { created () {
this.menus = createMenus(this)
}, },
methods: { methods: {
handleClick (e) { handleClick (e) {

View File

@ -0,0 +1,20 @@
export default function createMenus (app) {
const plugins = [
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' }
]
const menus = [
{ title: '首页', path: '/index', icon: 'home' },
{ title: '加速服务', path: '/server', icon: 'thunderbolt' },
{ title: '系统代理', path: '/proxy', icon: 'deployment-unit' },
{
title: '应用',
path: '/plugin',
icon: 'api',
children: plugins
}
]
if (app.$global && app.$global.setting && app.$global.setting.overwall) {
plugins.push({ title: '功能增强', path: '/plugin/overwall', icon: 'global' })
}
return menus
}