| | |
| | | <el-breadcrumb class="app-breadcrumb" separator="/">
|
| | | <transition-group name="breadcrumb">
|
| | | <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
|
| | | <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>
|
| | | <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
|
| | | </el-breadcrumb-item>
|
| | | </transition-group>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import pathToRegexp from 'path-to-regexp'
|
| | |
|
| | | export default {
|
| | | data() {
|
| | | return {
|
| | |
| | | if (!name) {
|
| | | return false
|
| | | }
|
| | | return name.trim() === '首页'
|
| | | },
|
| | | pathCompile(path) {
|
| | | const { params } = this.$route
|
| | | var toPath = pathToRegexp.compile(path)
|
| | | return toPath(params)
|
| | | return name.trim() === 'Index'
|
| | | },
|
| | | handleLink(item) {
|
| | | const { redirect, path } = item
|
| | |
| | | this.$router.push(redirect)
|
| | | return
|
| | | }
|
| | | this.$router.push(this.pathCompile(path))
|
| | | this.$router.push(path)
|
| | | }
|
| | | }
|
| | | }
|