删除多余的路由对象
This commit is contained in:
parent
15e0ecac94
commit
1ac4731ebb
@ -6,30 +6,7 @@ Vue.use(Router)
|
|||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
|
|
||||||
/**
|
// 创建静态路由对象: 登录, 首页, 404
|
||||||
* Note: sub-menu only appear when route children.length >= 1
|
|
||||||
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
|
||||||
*
|
|
||||||
* hidden: true if set true, item will not show in the sidebar(default is false)
|
|
||||||
* alwaysShow: true if set true, will always show the root menu
|
|
||||||
* if not set alwaysShow, when item has more than one children route,
|
|
||||||
* it will becomes nested mode, otherwise not show the root menu
|
|
||||||
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
|
||||||
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|
||||||
* meta : {
|
|
||||||
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
|
||||||
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
|
||||||
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
|
|
||||||
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
|
||||||
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constantRoutes
|
|
||||||
* a base page that does not have permission requirements
|
|
||||||
* all roles can be accessed
|
|
||||||
*/
|
|
||||||
export const constantRoutes = [
|
export const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
@ -37,12 +14,6 @@ export const constantRoutes = [
|
|||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
path: '/404',
|
|
||||||
component: () => import('@/views/404'),
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
@ -56,102 +27,9 @@ export const constantRoutes = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/example',
|
path: '/404',
|
||||||
component: Layout,
|
component: () => import('@/views/404'),
|
||||||
redirect: '/example/table',
|
hidden: true
|
||||||
name: 'Example',
|
|
||||||
meta: { title: 'Example', icon: 'el-icon-s-help' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'tree',
|
|
||||||
name: 'Tree',
|
|
||||||
component: () => import('@/views/tree/index'),
|
|
||||||
meta: { title: 'Tree', icon: 'tree' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
path: '/form',
|
|
||||||
component: Layout,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'index',
|
|
||||||
name: 'Form',
|
|
||||||
component: () => import('@/views/form/index'),
|
|
||||||
meta: { title: 'Form', icon: 'form' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
path: '/nested',
|
|
||||||
component: Layout,
|
|
||||||
redirect: '/nested/menu1',
|
|
||||||
name: 'Nested',
|
|
||||||
meta: {
|
|
||||||
title: 'Nested',
|
|
||||||
icon: 'nested'
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'menu1',
|
|
||||||
component: () => import('@/views/nested/menu1/index'), // Parent router-view
|
|
||||||
name: 'Menu1',
|
|
||||||
meta: { title: 'Menu1' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'menu1-1',
|
|
||||||
component: () => import('@/views/nested/menu1/menu1-1'),
|
|
||||||
name: 'Menu1-1',
|
|
||||||
meta: { title: 'Menu1-1' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'menu1-2',
|
|
||||||
component: () => import('@/views/nested/menu1/menu1-2'),
|
|
||||||
name: 'Menu1-2',
|
|
||||||
meta: { title: 'Menu1-2' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'menu1-2-1',
|
|
||||||
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
|
|
||||||
name: 'Menu1-2-1',
|
|
||||||
meta: { title: 'Menu1-2-1' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'menu1-2-2',
|
|
||||||
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
|
|
||||||
name: 'Menu1-2-2',
|
|
||||||
meta: { title: 'Menu1-2-2' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'menu1-3',
|
|
||||||
component: () => import('@/views/nested/menu1/menu1-3'),
|
|
||||||
name: 'Menu1-3',
|
|
||||||
meta: { title: 'Menu1-3' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'menu2',
|
|
||||||
component: () => import('@/views/nested/menu2/index'),
|
|
||||||
name: 'Menu2',
|
|
||||||
meta: { title: 'menu2' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
path: 'external-link',
|
|
||||||
component: Layout,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
|
|
||||||
meta: { title: 'External Link', icon: 'link' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 404 page must be placed at the end !!!
|
// 404 page must be placed at the end !!!
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form ref="form" :model="form" label-width="120px">
|
|
||||||
<el-form-item label="Activity name">
|
|
||||||
<el-input v-model="form.name" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Activity zone">
|
|
||||||
<el-select v-model="form.region" placeholder="please select your zone">
|
|
||||||
<el-option label="Zone one" value="shanghai" />
|
|
||||||
<el-option label="Zone two" value="beijing" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Activity time">
|
|
||||||
<el-col :span="11">
|
|
||||||
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%;" />
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2" class="line">-</el-col>
|
|
||||||
<el-col :span="11">
|
|
||||||
<el-time-picker v-model="form.date2" type="fixed-time" placeholder="Pick a time" style="width: 100%;" />
|
|
||||||
</el-col>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Instant delivery">
|
|
||||||
<el-switch v-model="form.delivery" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Activity type">
|
|
||||||
<el-checkbox-group v-model="form.type">
|
|
||||||
<el-checkbox label="Online activities" name="type" />
|
|
||||||
<el-checkbox label="Promotion activities" name="type" />
|
|
||||||
<el-checkbox label="Offline activities" name="type" />
|
|
||||||
<el-checkbox label="Simple brand exposure" name="type" />
|
|
||||||
</el-checkbox-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Resources">
|
|
||||||
<el-radio-group v-model="form.resource">
|
|
||||||
<el-radio label="Sponsor" />
|
|
||||||
<el-radio label="Venue" />
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Activity form">
|
|
||||||
<el-input v-model="form.desc" type="textarea" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="onSubmit">Create</el-button>
|
|
||||||
<el-button @click="onCancel">Cancel</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
form: {
|
|
||||||
name: '',
|
|
||||||
region: '',
|
|
||||||
date1: '',
|
|
||||||
date2: '',
|
|
||||||
delivery: false,
|
|
||||||
type: [],
|
|
||||||
resource: '',
|
|
||||||
desc: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onSubmit() {
|
|
||||||
this.$message('submit!')
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
this.$message({
|
|
||||||
message: 'cancel!',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.line{
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1">
|
|
||||||
<router-view />
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,7 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1-1" type="success">
|
|
||||||
<router-view />
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,7 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1-2" type="success">
|
|
||||||
<router-view />
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,5 +0,0 @@
|
|||||||
<template functional>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1-2-1" type="warning" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,5 +0,0 @@
|
|||||||
<template functional>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1-2-2" type="warning" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,5 +0,0 @@
|
|||||||
<template functional>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 1-3" type="success" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,5 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="padding:30px;">
|
|
||||||
<el-alert :closable="false" title="menu 2" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@ -1,79 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-table
|
|
||||||
v-loading="listLoading"
|
|
||||||
:data="list"
|
|
||||||
element-loading-text="Loading"
|
|
||||||
border
|
|
||||||
fit
|
|
||||||
highlight-current-row
|
|
||||||
>
|
|
||||||
<el-table-column align="center" label="ID" width="95">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.$index }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="Title">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.title }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="Author" width="110" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ scope.row.author }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="Pageviews" width="110" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.pageviews }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column class-name="status-col" label="Status" width="110" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<i class="el-icon-time" />
|
|
||||||
<span>{{ scope.row.display_time }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getList } from '@/api/table'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
filters: {
|
|
||||||
statusFilter(status) {
|
|
||||||
const statusMap = {
|
|
||||||
published: 'success',
|
|
||||||
draft: 'gray',
|
|
||||||
deleted: 'danger'
|
|
||||||
}
|
|
||||||
return statusMap[status]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
list: null,
|
|
||||||
listLoading: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.fetchData()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchData() {
|
|
||||||
this.listLoading = true
|
|
||||||
getList().then(response => {
|
|
||||||
this.list = response.data.items
|
|
||||||
this.listLoading = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,78 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-input v-model="filterText" placeholder="Filter keyword" style="margin-bottom:30px;" />
|
|
||||||
|
|
||||||
<el-tree
|
|
||||||
ref="tree2"
|
|
||||||
:data="data2"
|
|
||||||
:props="defaultProps"
|
|
||||||
:filter-node-method="filterNode"
|
|
||||||
class="filter-tree"
|
|
||||||
default-expand-all
|
|
||||||
/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
filterText: '',
|
|
||||||
data2: [{
|
|
||||||
id: 1,
|
|
||||||
label: 'Level one 1',
|
|
||||||
children: [{
|
|
||||||
id: 4,
|
|
||||||
label: 'Level two 1-1',
|
|
||||||
children: [{
|
|
||||||
id: 9,
|
|
||||||
label: 'Level three 1-1-1'
|
|
||||||
}, {
|
|
||||||
id: 10,
|
|
||||||
label: 'Level three 1-1-2'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
id: 2,
|
|
||||||
label: 'Level one 2',
|
|
||||||
children: [{
|
|
||||||
id: 5,
|
|
||||||
label: 'Level two 2-1'
|
|
||||||
}, {
|
|
||||||
id: 6,
|
|
||||||
label: 'Level two 2-2'
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
id: 3,
|
|
||||||
label: 'Level one 3',
|
|
||||||
children: [{
|
|
||||||
id: 7,
|
|
||||||
label: 'Level two 3-1'
|
|
||||||
}, {
|
|
||||||
id: 8,
|
|
||||||
label: 'Level two 3-2'
|
|
||||||
}]
|
|
||||||
}],
|
|
||||||
defaultProps: {
|
|
||||||
children: 'children',
|
|
||||||
label: 'label'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
filterText(val) {
|
|
||||||
this.$refs.tree2.filter(val)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
filterNode(value, data) {
|
|
||||||
if (!value) return true
|
|
||||||
return data.label.indexOf(value) !== -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user