vue项目初始化

一、脚手架创建项目

1、vue create 项目名

2、Manually select features :手动选择功能

3、

  •  (*) Babel
  •  ( ) TypeScript
  •  ( ) Progressive Web App (PWA) Support
  •  (*) Router
  •  (*) Vuex
  •  (*) CSS Pre-processors
  •  (*) Linter / Formatter
  •  ( ) Unit Testing
  •  ( ) E2E Testing

4、 (使用vue2)

  •    3.x
  • > 2.x

5、 Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) n

6、 (使用less)

   Sass/SCSS (with dart-sass)
> Less
   Stylus

7、(选择ESLint + Standard config)

   ESLint with error prevention only
   ESLint + Airbnb config
> ESLint + Standard config
   ESLint + Prettier
8、

  (*) Lint on save
>(*) Lint and fix on commit

9、(选择  In dedicated config files 保存单独的配置文件)

  In dedicated config files
  In package.json

10、Save this as a preset for future projects? (y/N)n

yarn serve  /  npm run serve  启动项目

二、加入git版本管理

# 添加远端仓库地址
git remote add origin 你的远程仓库地址

# 推送提交
git push -u origin master

三、调整目录结构

1、删除初始化的默认文件

2、新增src/api 目录、src/utils 目录、src/styles 目录(创建index.less 文件,存储全局样式,在 main.js 中加载全局样式)

调整后的目录结构:

.                                 
├── README.md                     
├── babel.config.js               
├── package-lock.json             
├── package.json                  
├── public                        
│   ├── favicon.ico               
│   └── index.html                
└── src                           
    ├── api            // 请求方法
    ├── App.vue        // 根组件              
    ├── assets         // 静态目录             
    ├── components     // 公共组件目录            
    ├── main.js        // 入口文件            
    ├── router         // 路由配置
    ├── utils          // 工具文件
    ├── styles         // 全局样式
    ├── store          // 仓库对象            
    └── views          // 页面视图
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值