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>
<el-breadcrumb class="app-breadcrumb" separator="/">
<transition-group name="breadcrumb">
<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>
<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>
<router-link v-else :to="item.redirect||item.path">{{item.meta.title}}</router-link>
</el-breadcrumb-item>
</transition-group>
@ -19,6 +19,11 @@ export default {
levelList: null
}
},
watch: {
$route() {
this.getBreadcrumb()
}
},
methods: {
getBreadcrumb() {
let matched = this.$route.matched.filter(item => item.name)
@ -28,11 +33,6 @@ export default {
}
this.levelList = matched
}
},
watch: {
$route() {
this.getBreadcrumb()
}
}
}
</script>

View File

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

View File

@ -9,7 +9,7 @@
</div>
<div class="bullshit">
<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__info">请检查您输入的网址是否正确请点击以下按钮返回主页或者发送错误报告</div>
<a href="/" class="bullshit__return-home">返回首页</a>

View File

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

View File

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

View File

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

View File

@ -1,27 +1,27 @@
<template>
<div class='menu-wrapper'>
<div class="menu-wrapper">
<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'>
<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>
<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>
</el-menu-item>
</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">
<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>
<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>
</template>
<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>
<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>
<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">
<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>
<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>
</el-menu-item>
</router-link>
</template>

View File

@ -1,7 +1,7 @@
<template>
<scroll-bar>
<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>
</scroll-bar>
</template>

View File

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