I"m going to write a demo, debugged on the mobile side: header, content and bottom, with three menus at the bottom, common headers and bottoms in the components folder, and other page components in the pages folder; now the problem is that the text in the component is not displayed (only the front page is displayed):
,,;
my router/index.js file is as follows:
import Vue from "vue"
import Router from "vue-router"
import Indexs from "../pages/index"
import Content from "../pages/content"
import Mine from "../pages/mine"
Vue.use(Router)
export default new Router({
routes: [
{
path: "/",
name: "index",
component: Indexs
},
{
path: "../pages/content",
name: "content",
component: Content
},
{
path: "../pages/mine",
name: "mine",
component: Mine
}
]
})
components/footer.vue file:
<template>
<div class="footer">
<a @click="changeTab(index)" :key="index" v-for="(tab, index) in tabs">{{ tab.title }}</a>
</div>
</template>
<script>
export default {
name: "footers",
data () {
return {
tabs: [
{
title: "",
path: "/"
},
{
title: "",
path: "../pages/content"
},
{
title: "",
path: "../pages/mine"
}
]
}
},
methods: {
changeTab (index) {
this.$router.push({path:this.tabs[index].path});
}
}
}
</script>
<style scoped>
.footer{
height: 50px;
width: 100%;
line-height: 50px;
position: fixed;
bottom: 0;
background-color: -sharp999;
color: -sharpfff;
text-align: center;
}
.footer a {
display: inline-block;
width: 33%;
}
</style>