Write the Code. Change the World.

1月 24

准备

安装 node.js

https://nodejs.org/en/

下载 LTS 的即可。配置环境变量

常用命令:

node -v

npm -v

# 设置镜像
sudo npm install -g cnpm --registry="https://registry.npm.taobao.org"

# 安装 yarn
sudo npm install -g yarn

# 设置镜像
yarn config set registry https://registry.npm.taobao.org --global

# 安装 vue cli
yarn global add @vue/cli

vue cli

安装初始化 vue 项目

# 会让你选择 vue 的版本
vue create test

基本配置

创建的 vue 项目的时候,目录里是没有 vue.config.js 文件的,我们需要手动加入。

在根目录下创建以下三个文件。

– src/settings.js
– .env.development
– .env.production
– vue.config.js

然后,填充内容。请参考:https://blog.vini123.com/525

安装 vue-router 以及 vuex

yarn add vue-router
yarn add vuex
yarn add axios
yarn add js-cookie

https://blog.csdn.net/weixin_43974265/article/details/114181405