Vue create front-end project

First go to the node.js official website (nodejs.org/zh-cn/), download the installation package, and run the installation directly. After the installation is complete, you will have the node and npm environment.
Insert picture description here
Use node -v
npm -v to see if the installation is successful

node -v
npm -v

Insert picture description here

# 安装淘宝npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
# vue-cli 安装依赖包
cnpm i -g @vue/cli

Install vue-cli 3.0, there will be vue ui command, after installing Vue3.0, use the command vue ui

# 打开vue的可视化管理工具界面
vue ui

Insert picture description here
Then the browser visits localhost:8000
Insert picture description here
and clicks create. The created directory is at the same level as running vue ui. Then click the button [Create a project here]
Insert picture description here
, enter the project name "blog-vue" in the project folder, click Next,
Insert picture description here
tick the manual configuration project, and then click Next.
Insert picture description here
Check the routing Router, state management Vuex,
Insert picture description here
turn off the check of js, and then click Next to Insert picture description here
open Use history mode for router, and then click Create project.
Insert picture description here
Select [Create project without saving preset], the vue project is created successfully.
Then we use WebStorm to open the project.
Insert picture description here
The purpose of components, such as the head, the left toolbar, the tail, and these common parts, are extracted and placed in the component.
The router is used to configure routing. The
store is the place for data state management. If the child component is updated, other components will be notified. All components will listen to the store. So once a component changes, it will notify other components of data synchronization.

Install element-ui and introduce the element-ui component (element.eleme.cn), so that we can get good-looking vue components.

# 切换到项目根目录
cd blog-vue
# 安装element-ui
cnpm install element-ui --save

Then open main.js in the project src directory and introduce element-ui dependency.
Insert picture description here
Install axios (www.axios-js.com/), axios is a promise-based HTTP library

cnpm install axios --save

Then we also introduce axios globally in main.js.
Insert picture description here

import axios from 'axios'
Vue.prototype.$axios = axios 

In the package.json file, elementui and axios appear, which means the introduction is successful.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_30353203/article/details/111242559