前端项目模板

yang yi 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
.vscode c1b1d32b4c # init project 1 maand geleden
public c1b1d32b4c # init project 1 maand geleden
src 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
.gitignore c1b1d32b4c # init project 1 maand geleden
README.md 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
index.html c1b1d32b4c # init project 1 maand geleden
package-lock.json 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
package.json 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
tsconfig.app.json 5b34054c16 # feat:安装vue-router和element-plus 1 maand geleden
tsconfig.json c1b1d32b4c # init project 1 maand geleden
tsconfig.node.json c1b1d32b4c # init project 1 maand geleden
vite.config.ts c1b1d32b4c # init project 1 maand geleden

README.md

Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Learn more about the recommended Project Setup and IDE Support in the Vue Docs TypeScript Guide.

前端模板项目

node18

Vue 3 + TypeScript + Vite6

构建过程

  1. 项目初始化

    npm create vite@6
    
  2. 添加vue-router和elementPlus依赖

    • 安装

      npm install vue-router@4
      npm install element-plus --save
      
    • 配置

      const routes:RouteRecordRaw[] = [
      {
         path: '/',
         name: 'commonLayout',
         component: CommonLayout,
         children: [
             {
                 path: '/',
                 name: 'home',
                 component: HomeView
             },
             {
                 path: '/about',
                 name: 'about',
                 component: AboutView
             },
         ],
      },
      ]
         
      const router : Router = createRouter({
      history: createWebHistory(),
      routes: routes,
      });
      export default router
      
    • 使用

      app.use(router)
      app.use(ElementPlus)
      
  3. 添加状态管理依赖

  4. 添加axios依赖

  5. openAPI自动生成接口调用