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

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

為什么的的enter值就是獲取不到 有獎(jiǎng)問答 幫忙者有紅包多謝大神們

? <template>

? ? <div id="app">

? ? ? ? <h1 v-text="msg">{{msg}}</h1>

? ? ? ? <input v-modle="newItem" v-on:keyup.enter="addNew">

? ? </div>

? ? <ul>

? ? ? ? ? <li v-for="item in items" v-bind:class="{finished: item.isFinished}" v-on:click="toggleFinsih(item)">

? ? ? ? ? ? {{item.label}}

? ? ? ? ? </li>

? ? </ul>

? </template>

? <script>

? export default {

? ? data () {

? ? ? return {

? ? ? // note: changing this line won't causes changes

? ? ? // with hot-reload because the reloaded component

? ? ? // preserves its current state and we are modifying

? ? ? // its initial state.

? ? ? ? msg: 'Hellosss Wrld!',

? ? ? ? items: [

? ? ? ? ? {

? ? ? ? ? ? label: 'coding',

? ? ? ? ? ? isFinished: false

? ? ? ? ? },

? ? ? ? ? {

? ? ? ? ? ? label: 'playing',

? ? ? ? ? ? isFinished: true

? ? ? ? ? }

? ? ? ? ]

? ? ? }

? ? },

? ? methods: {

? ? ? toggleFinsih: function (item) {

? ? ? ? item.isFinished = !item.isFinished

? ? ? },

? ? ? addNew: function () {

? ? ? ? console.log(this)

? ? ? }

? ? }

? }

? </script>

? <style>

? .finished{

? ? text-decoration: underline;

? }

? </style>


正在回答

3 回答

58653bd1000187e203730081.jpg

58653bd10001f73e03460380.jpg

58653bd20001ab8e02480063.jpg

  1. v-model的model你寫錯(cuò)了

  2. 應(yīng)該在data()里面加入newItem = '',參照1樓圖2的位置加入

  3. consle.log(this.newItem),括號(hào)里面應(yīng)該為this.newItem,可以理解為調(diào)用data()里面的newItem的值


0 回復(fù) 有任何疑惑可以回復(fù)我~

http://img1.sycdn.imooc.com//57ac50e50001f1b405240159.jpg
是不是因?yàn)関-model寫錯(cuò)了==

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

arlenhui

眼神刁鉆,可以
2016-08-13 回復(fù) 有任何疑惑可以回復(fù)我~

enter指的是輸入框輸入的值嗎?

如果是的話,那就獲取newItem就好了

在data里面注冊屬性

data?()?{
??????return?{
????????msg:?'Hellosss?Wrld!',
????????items:?[
??????????{
????????????label:?'coding',
????????????isFinished:?false
??????????},
??????????{
????????????label:?'playing',
????????????isFinished:?true
??????????}
????????],
????????newItem?:?''????????//注冊屬性
??????}
????}

然后在addNew事件里面直接可以打印出來看看

?methods:?{
??????toggleFinsih:?function?(item)?{
????????item.isFinished?=?!item.isFinished
??????},
??????addNew:?function?()?{
????????console.log(this.newItem);???????//打印屬性
??????}
????}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
vue.js入門基礎(chǔ)
  • 參與學(xué)習(xí)       209620    人
  • 解答問題       715    個(gè)

本門為vuejs入門教程,詳細(xì)的講解加實(shí)戰(zhàn),可以幫你進(jìn)入vuejs的大門

進(jìn)入課程

為什么的的enter值就是獲取不到 有獎(jiǎng)問答 幫忙者有紅包多謝大神們

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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