perf:format code

This commit is contained in:
Pan 2017-11-24 17:21:32 +08:00 committed by 花裤衩
parent 37b6253e14
commit b97b370f04
9 changed files with 32 additions and 30 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<el-breadcrumb class="app-breadcrumb" separator="/"> <el-breadcrumb class="app-breadcrumb" separator="/">
<transition-group name="breadcrumb"> <transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path" v-if='item.meta.title'> <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path" v-if="item.meta.title">
<span v-if='item.redirect==="noredirect"||index==levelList.length-1' class="no-redirect">{{item.meta.title}}</span> <span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{item.meta.title}}</span>
<router-link v-else :to="item.redirect||item.path">{{item.meta.title}}</router-link> <router-link v-else :to="item.redirect||item.path">{{item.meta.title}}</router-link>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
@ -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)
@ -28,11 +33,6 @@ export default {
} }
this.levelList = matched this.levelList = matched
} }
},
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

@ -9,7 +9,7 @@
</div> </div>
<div class="bullshit"> <div class="bullshit">
<div class="bullshit__oops">OOPS!</div> <div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">版权所有<a class='link-type' href='https://wallstreetcn.com' target='_blank'>华尔街见闻</a></div> <div class="bullshit__info">版权所有<a class="link-type" href="https://wallstreetcn.com" target='_blank'>华尔街见闻</a></div>
<div class="bullshit__headline">{{ message }}</div> <div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">请检查您输入的网址是否正确请点击以下按钮返回主页或者发送错误报告</div> <div class="bullshit__info">请检查您输入的网址是否正确请点击以下按钮返回主页或者发送错误报告</div>
<a href="/" class="bullshit__return-home">返回首页</a> <a href="/" class="bullshit__return-home">返回首页</a>

View File

@ -1,12 +1,13 @@
<template> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<div class='dashboard-text'>name:{{name}}</div> <div class="dashboard-text">name:{{name}}</div>
<div class='dashboard-text'>role:<span v-for='role in roles' :key='role'>{{role}}</span></div> <div class="dashboard-text">role:<span v-for='role in roles' :key='role'>{{role}}</span></div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'dashboard', name: 'dashboard',
computed: { computed: {

View File

@ -1,6 +1,7 @@
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<!-- <router-view :key="key"></router-view> -->
<router-view :key="key"></router-view> <router-view :key="key"></router-view>
</transition> </transition>
</section> </section>
@ -10,9 +11,9 @@
export default { export default {
name: 'AppMain', name: 'AppMain',
computed: { computed: {
key() { // key() {
return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date() // return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
} // }
} }
} }
</script> </script>

View File

@ -8,7 +8,7 @@
<i class="el-icon-caret-bottom"></i> <i class="el-icon-caret-bottom"></i>
</div> </div>
<el-dropdown-menu class="user-dropdown" slot="dropdown"> <el-dropdown-menu class="user-dropdown" slot="dropdown">
<router-link class='inlineBlock' to="/"> <router-link class="inlineBlock" to="/">
<el-dropdown-item> <el-dropdown-item>
Home Home
</el-dropdown-item> </el-dropdown-item>

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'>{{item.children[0].meta.title}}</span> <span v-if="item.children[0].meta&&item.children[0].meta.title">{{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'>{{item.meta.title}}</span> <span v-if="item.meta&&item.meta.title">{{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'>{{child.meta.title}}</span> <span v-if="child.meta&&child.meta.title">{{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='routes'></sidebar-item> <sidebar-item :routes="routes"></sidebar-item>
</el-menu> </el-menu>
</scroll-bar> </scroll-bar>
</template> </template>

View File

@ -22,7 +22,7 @@
Sign in Sign in
</el-button> </el-button>
</el-form-item> </el-form-item>
<div class='tips'> <div class="tips">
<span style="margin-right:20px;">username: admin</span> <span style="margin-right:20px;">username: admin</span>
</span> password: admin</span> </span> password: admin</span>
</div> </div>