app.vue
<template>
<div id="app">
<login></login>
<router-view/>
</div>
</template>
<script>
import login from "./components/login/login.vue"
export default {
name: "App",
components:{
login
}
}
</script>
login.vue
<template>
<div class="login">
<form action="">
<input type="text" placeholder="//"><br>
<input type="password" placeholder="">
<router-link :to="{name:"Tabbar"}"><input type="button" value="" class="btn"/> </router-link>
</form>
</div>
</template>
tabbar.vue
<template>
<div class="tabbar">
<child @back="getValue" mark="home" :sel="select" title="">
<img src="../assets/ic_tab_home_normal.png" slot="active"/>
<img src="../assets/ic_tab_home_active.png" slot="normal"/>
</child>
<child @back="getValue" mark="team" :sel="select" title="">
<img src="../assets/ic_tab_subject_normal.png" slot="active"/>
<img src="../assets/ic_tab_subject_active.png" slot="normal"/>
</child>
<child @back="getValue" mark="salary" :sel="select" title="">
<img src="../assets/ic_tab_status_normal.png" slot="active"/>
<img src="../assets/ic_tab_status_active.png" slot="normal"/>
</child>
<child @back="getValue" mark="check" :sel="select" title="">
<img src="../assets/ic_tab_group_normal.png" slot="active"/>
<img src="../assets/ic_tab_group_active.png" slot="normal"/>
</child>
<child @back="getValue" mark="personal" :sel="select" title="">
<img src="../assets/ic_tab_profile_female_normal.png" slot="active"/>
<img src="../assets/ic_tab_profile_female_active.png" slot="normal"/>
</child>
</div>
</template>
<script>
import child from "./child"
export default {
components: {
child
},
data: function () {
return {select: "home"}
},
methods: {
getValue: function (n) {
this.select = n;
}
}
}
</script>
index.js
import Vue from "vue"
import Router from "vue-router"
import Tabbar from "@/components/tabbar"
import Home from "@/components/home/home"
import Classify from "@/components/classify/classify"
import Team from "@/components/team/team"
import Salary from "@/components/salary/salary"
import Check from "@/components/check/check"
import Personal from "@/components/personal/personal"
Vue.use(Router);
export default new Router({
mode: "history",
routes: [
{
path: "/tabbar",
name: "Tabbar",
component: Tabbar,
},
{
path: "/home",
name: "Home",
component: Home,
},{
path: "/salary",
name: "Salary",
component: Salary,
redirect: {name: "TermSearch"},
children:[
{path:"termSearch",name: "TermSearch",component:TermSearch},
{path:"termAnalyse",name: "TermAnalyse",component:TermAnalyse}
]
},
{
path: "/check",
name: "Check",
component: Check,
redirect: {name: "PersonWarn"},
children:[
{path:"personWarn",name: "PersonWarn",component:PersonWarn},
{path:"teamWarn",name: "TeamWarn",component:TeamWarn}
]
},
{
path: "/personal",
name: "Personal",
component: Personal
},
]
})
this is the effect after clicking to log in, but the route jumps to the tabbar,login page but still exists, and the home page is not displayed.
Click on the home page, the home page shows, and the tabbar does not show whether the
login page cannot be specified in the app.vue
ask the boss for advice