Vue.js is detailed from the installation to the construction process

In the initial time, VUE is directly downloaded related files in the previous method

later found that it seems more convenient after installation, and then began to ponder how to set up the frame The following is the process:


Direct online download is good

2 , Install Taobao mirror


 npm install -g cnpm --registry = https://registry.npm.taobao  3, install Webpack  
CNPM INSTALL WebPack -G


4, the new folder is used to store the project file
  CD into your file path  
VUE INIT WebPack-SIMPLE project name (name cannot be used in Chinese)


Target Directory Exists. Continue? (Y / N) Direct Enter Default Project Name (Vue-Test) Direct Enter Default Project Description (a Vue.js Project) Direct Enter Default Author Write your own name


5, after completion, you will find the required files in your folder.

6, installing NPM projects depending on this step is relatively slow because there are many files
   
NPM INSTALL

7, run your project

vue.js从安装到搭建过程详解

To here, your basic installation and construction are completed
  Write some of the introduction of some of the required documents in the project  
1, jQuery Import

When he discussed with others, he said that VUE didn’t need JQuery but our project said to install, so I installed -_-
first is the command line. Installation
  NPM Install jquery --save  

Meaning to reserve to the local

Then webPack.config.js

module.exports.plugins = =


New WebPack.Optimize.commonschunkPlugin (‘Common.js’), New WebPack .Provideplugin ({$: ‘jQuery’, jQuery: ‘jQuery’})


An addition of JS to reference

 IMPORT $ from 'jQuery'Window. $ = $   
Such jQuery successfully imported the project


2, static CSS and JS introduction

Static CSS introduction It is in the corresponding .vue file in IMPORT
, for example   
@Import ‘./assets/css/global.css’;

 Static JS Require in the corresponding JS and these JS and CSS should be placed under Assets   
Require (‘./ assets / js / “


3, Vue-Resource Import

There is also the ELEMENTUI import method is the same as an example of medical Vue-resource as an example.


NPM Install Vue-Resource – Save
After the Import in JS that needs to be imported [”
   Import vueresource from 'Vue-Resource'Vue.use (VueResource) 
This article has been organized to “VUE .JS front-end component learning tutorial, welcome to learn to read.

With regard to the tutorial of the Vue.js component, please click on the Topic Vue.js Component Learning Tutorial for learning.
The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.
                    
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment