使用 Vue.js 2.0 开发后台

目录

  • vue-cli 安装与使用

vue-cli 安装与使用

vue-cli 是 Vue.js 官方发布的 Vue.js 项目脚手架,使用 vue-cli 可以快速创建 Vue.js 项目,执行安装命令如下:

1
npm install -g vue-cli

vue-cli 用法如下,其中 template-name 是模块打包器名称,project-name 是项目名称。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 语法
vue init <template-name> <project-name>
# 例子
vue init webpack vue-element-website-backend
# 初始化过程
? Project name (vue-element-website-backend)
? Project description (A Vue.js project)
? Author luisedware <XXXXXXXXXXX@qq.com>
? Vue build (Use arrow keys)
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes
# 执行命令完成安装
cd vue-element-website-backend
npm install
npm run dev

安装完成后,在 Github 新建 repository,并把 Vue.js 项目 push 上去,执行命令如下:

1
2
3
4
5
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/luisedware/vue-element-website-backend.git
git push -u origin master