第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何正確使用Vue.js的組件?

如何正確使用Vue.js的組件?

ibeautiful 2018-10-01 09:05:48
如何正確使用Vue.js的組件
查看完整描述

1 回答

?
墨色風(fēng)雨

TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超6個(gè)贊

  1. # 下載最新的vue
    $ npm install vue


  2. js 引用 vue.js


  3. 開(kāi)始代碼,感受vue強(qiáng)大的雙向數(shù)據(jù)綁定



1234567891011<div id="app">  <p>{{ message }}</p>  <input v-model="message"></div>     new Vue({  el: '#app',  data: {    message: 'Hello Vue.js!'  }})




實(shí)戰(zhàn)代碼:

12345678910111213141516171819202122232425262728293031<div id="app">  <input v-model="newTodo" v-on:keyup.enter="addTodo">  <ul>    <li v-for="todo in todos">      <span>{{ todo.text }}</span>      <button v-on:click="removeTodo($index)">X</button>    </li>  </ul></div>     new Vue({  el: '#app',  data: {    newTodo: '',    todos: [      { text: 'Add some todos' }    ]  },  methods: {    addTodo: function () {      var text = this.newTodo.trim()      if (text) {        this.todos.push({ text: text })        this.newTodo = ''      }    },    removeTodo: function (index) {      this.todos.splice(index, 1)    }  }})




Vue整個(gè)生命周期示意圖:




查看完整回答
反對(duì) 回復(fù) 2018-10-21
  • 1 回答
  • 0 關(guān)注
  • 703 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)