本文共 1363 字,大约阅读时间需要 4 分钟。
创建项目: vue init webpack tabbardemo
项目所需的图片: 提取码:bo79
App.vue
MainTabBar.vue
![]()
首页![]()
分类![]()
购物车![]()
我的
TabBar.vue
TabBarItem.vue
Cart.vue
购物车
Category.vue
分类
Home.vue
首页
Profile.vue
个人
index.js
import Vue from 'vue'import VueRouter from "vue-router";const Home = () => import('views/home/Home')const Category = () => import('views/category/Category')const Cart = () => import('views/cart/Cart')const Profile = () => import('views/profile/Profile')// 1.安装插件Vue.use(VueRouter)// 2.创建路由对象const routes = [ { path: '', redirect: '/home' }, { path: '/home', component: Home }, { path: '/category', component: Category }, { path: '/cart', component: Cart }, { path: '/profile', component: Profile }]const router = new VueRouter({ routes, // 使用history mode: 'history'})// 3.导出routerexport default router
转载地址:http://fnjx.baihongyu.com/