搭建vue项目

vue create my-system

  • app.vue: 删除style样式,结构保留router-view

  • component和view文件夹:删除全部文件

  • view文件:新建login/LoginView.vue(大驼峰命名法一定要用!)





  • router/index.js文件:

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // 路由懒加载
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
  • vue.config.js

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false
})

你可能感兴趣的:(Vue,vue.js,javascript,前端)