1.1 项目目录
创建项目: vue init webpack tabbardemo
1.2 项目实现代码
项目所需的图片:https://pan.baidu.com/s/1T0LxSsT4yGamy3giIKcNFw 提取码:bo79
App.vue
<template>
<div id="app">
<!--使用组件-->
<router-view></router-view>
<main-tab-bar></main-tab-bar>
</div>
</template>
<script>
// 导入主键
import MainTabBar from "components/maintabbar/MainTabBar";
export default {
name: 'App',
// 注册组件
components:{
MainTabBar
}
}
</script>
<style>
@import "./assets/css/base"
</style>
MainTabBar.vue
<template>
<tab-bar>
<tab-bar-item path="/home" active-color="pink">
<img slot="item-icon" src="~assets/img/tabbr/home.svg" alt="">
<img slot="item-icon-active" src="~assets/img/tabbr/home_active.svg" alt="">
<div slot="item-text">首页</div>
</tab-bar-item>
<tab-bar-item path="/category" active-color="pink">
<img slot="item-icon" src="~assets/img/tabbr/category.svg" alt="">
<img slot="item-icon-active" src