Vue + Vux + Axios build a simple front-end frame

1. Preparations

Please confirm first Whether you have installed node and vue on your computer, if you don’t have the installed partner, “Baidu it” by yourself~

1, check this The node version of the machine

node -v 

2. Check the vue version of this machine

vue -V (note that -V is capitalized here)

Share a picture

2. Install vue-cli and configure the vue command environment (this step is enough, if your computer has installed this environment before, you can skip this step.)

cnpm install vue-cli -g

If the following picture appears, it proves that you have succeeded~

share picture

< span style="font-size: 18px;">Three, initialize a project, give it a cool name, such as first-vue-project

< pre>vue init webpack first-vue-project

The result is shown in the figure:

share picture

The content in the yellow box above is the basic configuration, and the content in the blue box is what you need to do next

First enter the project: cd first-vue-project


Run the project again: npm run dev

Share pictures

Finally, enter the link in the web page: http://localhost:8080

If the following picture appears, congratulations on your success~~~~

share picture

Fourth, package output, go online

npm run build 

(To terminate the current operation is ctrl+c )

share picture

Five. Install vux

  • Open the project with vscode and create a new command terminal

share Picture

  • Install vux
Enter: npm install vux --save

Share a picture

(Note: Don’t think that you can use vux happily in this way, because the official document writes vux2 Must be used with vux-loader, so next Just need to install vux-loader)

  • Install vux-loader
Enter: npm install vux- loader --save-dev

share picture

  • Modify the configuration file of webpack.base.conf.js (refer to the official document: https://doc.vux.li/zh-CN/install/npm.html)

Share a picture

Share a picture

  • Install less-loader (I thought this step is on-demand, so I didn’t install it at the beginning. Run directly and report an error. After returning and installing, you can run successfully)
Enter: npm install less less-loader --save-dev  

share picture

VI. About the use of vux:

  • First create a vue file, and then configure its routing (you can also write directly in HelloWorld. vue file)

share picture

  • Add in mian.js
import {AlertPlugin, ToastPlugin} from ‘vux‘

Vue.use(AlertPlugin)
Vue.use(ToastPlugin)

  • VuxDemo.vue file code:



  • Effects:

Share pictures

Seven, about axios

  • Install axios
Input: npm install axios

  • Effects:

Share a picture

  • You can see the configuration information in the package.json folder of the project:

Share a picture

Axios example:

 1 

Result image:

Share a picture

< /p>


Share for the first time, if you have any shortcomings, please point out, I hope everyone can make progress together (#^.^#)!

node -v 

vue -V (note that -V is capitalized here)

cnpm install vue-cli -g

vue init webpack first-vue-project

 First enter the project: cd first-vue-project


Run the project again: npm run dev

npm run build 

Enter: npm install vux --save

input: npm install vux-loader --save-dev

input: npm install less less -loader --save-dev 

import {AlertPlugin, ToastPlugin} from'vux'

Vue.use(AlertPlugin)
Vue.use(ToastPlugin)

  • VuxDemo.vue file code:



  • Effects:

Share pictures

Seven, about axios

import {AlertPlugin, ToastPlugin} from'vux'

Vue.use(AlertPlugin)
Vue.use(ToastPlugin)




Enter: npm install axios

 1 

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3927 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.