文章目录
1.封装选项卡
App.vue
<template>
<div>
<!-- 把选项卡中的电影,个人中心等封装到单独组件tabbar中 -->
<tabbar></tabbar>
<router-view></router-view>
</div>
</template>
<script>
// 导入组件tabbar
import tabbar from "./components/tabbar"
export default {
name: "App",
components: {
tabbar,
},
};
</script>
src/components/tabbar.vue
<template>
<footer>
<ul>
<router-link to="/Film" custom v-slot="{navigate,isActive}">
<li @click="navigate" :class="isActive?'myactive':''">
<i class="iconfont icon-dianying">热映电影</i>
</li>
</router-link>
<router-link to="/Cinema" custom v-slot="{navigate,isActive}">
<li @click="navigate" :class=