vue base (1)

view

Use:

Method One: the official website to download and install

Method two: by npm introducing dependent (installed Node , Node contains npm)

 

View version command (to see if the installation):

node -v

npm -v

NPM (Node) of the mirror installation and setting

Mirroring mode switching:

Manual switch

Switching means (NRM)

1. Install nrm:

npm install nrm -g// - g global mount

2. View nrm Mirror:

nrm ls

Mirror test speed:

nrm test npm

3. Change the Mirror

nrm use taobao// use Ali's image

 

Vue introduced in the project

idea to create an empty project

 

Join in the model of static web

 

Enter the terminal window

npm init -y // initialize the project

 

Installation vue

npm install vue --save // ​​- save local installation is available only for the current project

Vue introduced in html

<body>
<script src="node_modules/vue/dist/vue.js"></script>
</body>

 

vue basic use


<div ID = "App">
  <Button @ colck = "the Click"> function performed </ Button>
  <INPUT type = "text" Model V-NUM => // way binding
  <h2> {{name}} < / H2>
  <br> NUM} {} {
</ div> <Script the src = "./ the node_modules / VUE / dist / vue.js"> </ Script> <Script>   var App = new new Vue ({ // Create Object vue       el: "# app", // el, i.e., the element to render page elements.       data: data {//           name: "",           NUM: 0       },   methods: {// definition of function the method of       click () {           the console.log ( "Hello");           }       },       created () {// hook function           // AJAX request to the background initialization date data
















          this.name = "jdh"; // this point objects vue
          the setTimeout (() => = this.name "Jiang", 2000)
  }   }); </ Script>


 

vue life cycle

 

 

Guess you like

Origin www.cnblogs.com/dehao/p/10991996.html