项目创建好,接下来引入Container 布局容器,
aside Header
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import AppLayout from '@/layout/layoutName.vue'const routes: RouteRecordRaw [] = [{path: '/',component: AppLayout,children: [{path: '/',name: 'home',component: () => import('@/views/home/indexName.vue')}]},{path: '/login',name: 'login',component: () => import('../views/login/indexName.vue')}
]const router = createRouter({history: createWebHashHistory(),routes
})export default router
Navigator Oneitem one item two item three item fouritem one Navigator Two Navigator Three Navigator Four
Header
# NPM
$ npm install @element-plus/icons-vue
# Yarn
$ yarn add @element-plus/icons-vue
# pnpm
$ pnpm install @element-plus/icons-vue
import { App } from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'export default {install (app: App) {for (const [key, component] of Object.entries(ElementPlusIconsVue)) {app.component(key, component)}}
}
import { createApp } from 'vue'
import App from './App.vue'
// 引入element icon
import elementIcon from './plugins/element-plus-icon'const app = createApp(App)
app.use(elementIcon)
...
import { RouteRecordRaw, RouterView } from 'vue-router'const routes: RouteRecordRaw = {path: 'product',name: 'product',component: RouterView,children: [{path: 'product_list',name: 'product_list',component: () => import('@/views/product/list/indexName.vue')},{path: 'product_attr',name: 'product_attr',component: () => import('@/views/product/attr/indexName.vue')},{path: 'product_classify',name: 'product_classify',component: () => import('@/views/product/classify/indexName.vue')},{path: 'product_reply',name: 'product_reply',component: () => import('@/views/product/reply/indexName.vue')}]}export default routes
import product from './modules/product'const routes: RouteRecordRaw [] = [{path: '/',component: AppLayout,children: [{path: '/',name: 'home',component: () => import('@/views/home/indexName.vue')},product]},...
]
首页 商品 列表 规格