課程
/前端開發(fā)
/Vue.js
/vue2.5入門
刪除的方法一直顯示未在實例中定義
2019-03-20
源自:vue2.5入門 4-2
正在回答
你這個<list-item
????????? ?@delete="amputate"? ?這個@delete是子組件內(nèi)傳出的函數(shù)? methods: {
????????????????????????????????????????????????????????????????????????????????????????????????????????????子組件綁定刪除事件
????????????????????????????????????????????????????????????????????????????????????????????????????????????handerDetlete() {
????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????this.$emit("delete", this.index);
????????????????????????????????????????????????????????????????????????????????????????????????????????????????其中“detele”是子組件傳遞給父組件的事件也就是綁定在 <list-item @delete="amputale" :index="index">中的 @delete監(jiān)聽事件
????????????????????????????????????????????????????????????????????????????????????????????????????????????????this.index是子組件傳遞給父組件的參數(shù)?
????????????????????????????????????????????????????????????????????????????????????????????????????????????}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
????????????>
父組件綁定(調(diào)用子組件刪除)
methods: {
? ? ?amputale(index) {
????????// index?是從?this.$emit("delete", this.index);?中 this.index傳出的值
????????this.list.splice(index, 1);
? ?}
}
盛夏黃昏 提問者
好吧真的不知道取什么名字 回復(fù) 盛夏黃昏 提問者
盛夏黃昏 提問者 回復(fù) 好吧真的不知道取什么名字
yuyan 回復(fù) 盛夏黃昏 提問者
舉報
快速理解Vue編程理念上手Vue2.0開發(fā)。
1 回答方法未定義
4 回答方法定義在哪里
1 回答“Cannot read property 'splice' of undefined” 為什么會說splice未定義?
3 回答組件定義的問題
2 回答vue沒有定義怎么解決
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2019-03-21
你這個<list-item
????????? ?@delete="amputate"? ?這個@delete是子組件內(nèi)傳出的函數(shù)? methods: {
????????????????????????????????????????????????????????????????????????????????????????????????????????????子組件綁定刪除事件
????????????????????????????????????????????????????????????????????????????????????????????????????????????handerDetlete() {
????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????this.$emit("delete", this.index);
????????????????????????????????????????????????????????????????????????????????????????????????????????????????其中“detele”是子組件傳遞給父組件的事件也就是綁定在 <list-item @delete="amputale" :index="index">中的 @delete監(jiān)聽事件
????????????????????????????????????????????????????????????????????????????????????????????????????????????????this.index是子組件傳遞給父組件的參數(shù)?
????????????????????????????????????????????????????????????????????????????????????????????????????????????}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
????????????>
父組件綁定(調(diào)用子組件刪除)
methods: {
? ? ?amputale(index) {
????????// index?是從?this.$emit("delete", this.index);?中 this.index傳出的值
????????this.list.splice(index, 1);
? ?}
}