perf:format code

This commit is contained in:
Pan 2017-11-27 10:46:08 +08:00
parent f876b9b678
commit c06baffb17
8 changed files with 24 additions and 25 deletions

View File

@ -19,6 +19,11 @@ export default {
levelList: null levelList: null
} }
}, },
watch: {
$route() {
this.getBreadcrumb()
}
},
methods: { methods: {
getBreadcrumb() { getBreadcrumb() {
let matched = this.$route.matched.filter(item => item.name) let matched = this.$route.matched.filter(item => item.name)
@ -31,11 +36,6 @@ export default {
generateTitle(title) { generateTitle(title) {
return this.$t('route.' + title) return this.$t('route.' + title)
} }
},
watch: {
$route() {
this.getBreadcrumb()
}
} }
} }
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class='scroll-container' ref='scrollContainer' @mousewheel="handleScroll"> <div class="scroll-container" ref="scrollContainer" @mousewheel="handleScroll">
<div class='scroll-wrapper' ref='scrollWrapper' :style="{top: top + 'px'}"> <div class="scroll-wrapper" ref="scrollWrapper" :style="{top: top + 'px'}">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class='scroll-container' ref='scrollContainer' @mousewheel="handleScroll"> <div class="scroll-container" ref="scrollContainer" @mousewheel="handleScroll">
<div class='scroll-wrapper' ref='scrollWrapper' :style="{left: left + 'px'}"> <div class="scroll-wrapper" ref="scrollWrapper" :style="{left: left + 'px'}">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>

View File

@ -1,3 +1,4 @@
@import './variables.scss';
@import './mixin.scss'; @import './mixin.scss';
@import './transition.scss'; @import './transition.scss';
@import './element-ui.scss'; @import './element-ui.scss';

View File

@ -1,5 +1,3 @@
@import './variables.scss';
#app { #app {
// 主体区域 // 主体区域
.main-container { .main-container {

View File

@ -1,7 +1,7 @@
<template> <template>
<section class="app-main" style="min-height: 100%"> <section class="app-main" style="min-height: 100%">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<keep-alive :include='cachedViews'> <keep-alive :include="cachedViews">
<router-view></router-view> <router-view></router-view>
</keep-alive> </keep-alive>
</transition> </transition>

View File

@ -1,27 +1,27 @@
<template> <template>
<div class='menu-wrapper'> <div class="menu-wrapper">
<template v-for="item in routes"> <template v-for="item in routes">
<router-link v-if="!item.hidden&&item.children&&item.children.length===1" :to="item.path+'/'+item.children[0].path" :key='item.children[0].name'> <router-link v-if="!item.hidden&&item.children&&item.children.length===1" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name">
<el-menu-item :index="item.path+'/'+item.children[0].path" class='submenu-title-noDropdown'> <el-menu-item :index="item.path+'/'+item.children[0].path" class='submenu-title-noDropdown'>
<svg-icon v-if='item.children[0].meta&&item.children[0].meta.icon' :icon-class="item.children[0].meta.icon"></svg-icon> <svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
<span v-if='item.children[0].meta&&item.children[0].meta.title'>{{generateTitle(item.children[0].meta.title)}}</span> <span v-if="item.children[0].meta&&item.children[0].meta.title">{{generateTitle(item.children[0].meta.title)}}</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
<el-submenu v-if="!item.hidden&&item.children&&item.children.length>1" :index="item.name||item.path" :key='item.name'> <el-submenu v-if="!item.hidden&&item.children&&item.children.length>1" :index="item.name||item.path" :key="item.name">
<template slot="title"> <template slot="title">
<svg-icon v-if='item.meta&&item.meta.icon' :icon-class="item.meta.icon"></svg-icon> <svg-icon v-if="item.meta&&item.meta.icon" :icon-class="item.meta.icon"></svg-icon>
<span v-if='item.meta&&item.meta.title'>{{generateTitle(item.meta.title)}}</span> <span v-if="item.meta&&item.meta.title">{{generateTitle(item.meta.title)}}</span>
</template> </template>
<template v-if='!child.hidden' v-for="child in item.children"> <template v-if="!child.hidden" v-for="child in item.children">
<sidebar-item class='nest-menu' v-if='child.children&&child.children.length>0' :routes='[child]' :key='child.path'></sidebar-item> <sidebar-item class="nest-menu" v-if="child.children&&child.children.length>0" :routes="[child]" :key="child.path"></sidebar-item>
<router-link v-else :to="item.path+'/'+child.path" :key='child.name'> <router-link v-else :to="item.path+'/'+child.path" :key="child.name">
<el-menu-item :index="item.path+'/'+child.path"> <el-menu-item :index="item.path+'/'+child.path">
<svg-icon v-if='child.meta&&child.meta.icon' :icon-class="child.meta.icon"></svg-icon> <svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
<span v-if='child.meta&&child.meta.title'>{{generateTitle(child.meta.title)}}</span> <span v-if="child.meta&&child.meta.title">{{generateTitle(child.meta.title)}}</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
</template> </template>

View File

@ -1,7 +1,7 @@
<template> <template>
<scroll-bar> <scroll-bar>
<el-menu mode="vertical" unique-opened :default-active="$route.path" :collapse="isCollapse" background-color="#304156" text-color="#fff" active-text-color="#409EFF"> <el-menu mode="vertical" unique-opened :default-active="$route.path" :collapse="isCollapse" background-color="#304156" text-color="#fff" active-text-color="#409EFF">
<sidebar-item :routes='permission_routers'></sidebar-item> <sidebar-item :routes="permission_routers"></sidebar-item>
</el-menu> </el-menu>
</scroll-bar> </scroll-bar>
</template> </template>