Create a project
Scaffolding
Create a project:
npx create-nuxt-app 项目名称
cd 项目目录
npm run dev
New projects from scratch
Directory Structure
routing
Automatic routing configuration
- The default pages in the page will automatically generate routing configuration information
Manually configured routing
-
create
nuxt.config.js
-
Configuration
module.exports = { router: { // routes 默认的路由表 // resolve 一个函数,用来配置路由组件的路径 extendRoutes (routes, resolve) { routes.push({ name: 'abc', path: '/abc', component: resolve(__dirname, 'views/test.vue') }) console.log(routes) } } }