cli scaffold (framework) cli scaffold (framework)

cli scaffold (framework)

 

First, create a project vue

Copy the code
  1 npm install vue-cli -g # -g global
  2 (sudo) npm install vue-cli -g #mac notebook
  3 
  Name 4 vue-init webpack myvue # project
  5 cd muvue
  6 npm install
  7 npm run dev
Copy the code

 

Second, the description of the directory structure

1184802-20180128182614756-595528902

Such a graph below appear that success

Three differences, import and require the

    import must be placed on top of the file, he acts as a pointer reference to the file, the file does not contain it came in, introduced only need to call the file 
require files can now be placed anywhere, he is right files directly include it

Fourth, set the file path in a process

1) establishing component (.vue file)
2) Route Configuration (configuration file The index.js)
3)<router-link></router-link>
4)<router-view></router-view>
5) import package names from "Component Path"
6) comonents register

Fifth, to achieve asynchronous loading

//asynchronous
vue-resource: asynchronous load data (deprecated)
axios: asynchronous load data
npm install axios --save-dev
npm install vue-axios --save-dev

First, create a project vue

Copy the code
  1 npm install vue-cli -g # -g global
  2 (sudo) npm install vue-cli -g #mac notebook
  3 
  Name 4 vue-init webpack myvue # project
  5 cd muvue
  6 npm install
  7 npm run dev
Copy the code

 

Second, the description of the directory structure

1184802-20180128182614756-595528902

Such a graph below appear that success

Three differences, import and require the

    import must be placed on top of the file, he acts as a pointer reference to the file, the file does not contain it came in, introduced only need to call the file 
require files can now be placed anywhere, he is right files directly include it

Fourth, set the file path in a process

1) establishing component (.vue file)
2) Route Configuration (configuration file The index.js)
3)<router-link></router-link>
4)<router-view></router-view>
5) import package names from "Component Path"
6) comonents register

Fifth, to achieve asynchronous loading

//asynchronous
vue-resource: asynchronous load data (deprecated)
axios: asynchronous load data
npm install axios --save-dev
npm install vue-axios --save-dev

Guess you like

Origin www.cnblogs.com/hwa3020/p/11901753.html