You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
<template>
|
|
<div id="app">
|
|
<router-view />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import router from '@/router/index'
|
|
export default {
|
|
name: 'App',
|
|
|
|
watch: {
|
|
$route(to){
|
|
const path = `/${to.path.split('/')[1]}`
|
|
this.setCode(path)
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
setCode(path) {
|
|
router.options.routes.forEach(first => {
|
|
if(first && first.path && first.path === path){
|
|
localStorage.setItem('code', first.code)
|
|
return;
|
|
}else{
|
|
if(first.children && first.children.length){
|
|
first.children.forEach(second => {
|
|
if(second && second.path && second.path === path){
|
|
localStorage.setItem('code', second.code)
|
|
return;
|
|
}else{
|
|
if(second.children && second.children.length){
|
|
second.children.forEach(third => {
|
|
if(third && third.path && third.path === path){
|
|
localStorage.setItem('code', third.code)
|
|
return;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
#table-content table th{
|
|
padding: 0 10px!important;
|
|
background-color: #f1f1f1;
|
|
}
|
|
#table-content table td{
|
|
padding: 0 10px!important;
|
|
}
|
|
</style>
|
|
|