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.

59 lines
1.4 KiB

6 years ago
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
import router from '@/router/index'
6 years ago
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;
}
})
}
}
})
}
}
})
}
}
6 years ago
}
</script>
6 years ago
<style>
#table-content table th{
padding: 0 10px!important;
background-color: #f1f1f1;
}
#table-content table td{
padding: 0 10px!important;
}
6 years ago
</style>