課程
/前端開發(fā)
/Vue.js
/vue2.5入門
todo-item中l(wèi)i標簽的key已經(jīng)綁定賦值了index,但是為什么,我在li標簽的點擊事件里獲取索引值是undefined
2018-10-26
源自:vue2.5入門 3-4
正在回答
你使用的時候,網(wǎng)頁就已經(jīng)報錯了
報錯信息:
[Vue warn]: "key" is a reserved attribute and cannot be used as component prop.
key是個保留字,不能用于組件屬性
點擊的時候用到的 是 index , 而不是 key, 所以 要另外 綁定 :index="index"
舉報
快速理解Vue編程理念上手Vue2.0開發(fā)。
2 回答<todo-item>中,為什么不能直接用{{item}},而要定義一個content?
1 回答todo-item 不起作用
4 回答為什么不能直接傳遞屬性key
3 回答為什么不用key
6 回答老師這里的 :index,下面不能直接用 :key直接當做屬性傳遞嗎?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2019-04-03
你使用的時候,網(wǎng)頁就已經(jīng)報錯了
報錯信息:
[Vue warn]: "key" is a reserved attribute and cannot be used as component prop.
key是個保留字,不能用于組件屬性
2018-10-27
點擊的時候用到的 是 index , 而不是 key, 所以 要另外 綁定 :index="index"