亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么可以在tabs組件里使用todo?

computed: {

? ?unFinishedTodoLength() {

? ? ?return this.todos.filter(todo => !todo.completed).length

? ?}

并沒有向tabs組件傳入todo,為什么可以使用

正在回答

2 回答

在父組件todo.vue中:

<tabs @toggle="toggleFilter"?

:filter="filter"??//在這里把filter傳給子組件tabs

:todos="todos"? //在這里把todos傳給子組件tabs

@clearAllCompleted="clearAllCompleted"

/>

在子組件todo.vue中:

props: {? ?//通過props這個屬性把父組件要傳過來的數據傳過來

????filter: {? ?//這個是父組件數據filter

????????type: String,? //定義filter傳過來的類型

????????required: true? //是否必須要filter這個數據,true就是必須要

????},

????todos: {

????????type: Array,? //定義todos傳過來的類型

????????required: true

????}

},


1 回復 有任何疑惑可以回復我~
#1

歐先先生

第二個是在子組件tabs.vue中吧
2018-09-08 回復 有任何疑惑可以回復我~

父組件prop數據到子組件

<Tabs?
???:filter="filter"?
???:todos="todos"
???@toggle="toggleFilter"
???@clearAll="clearAllcompleted"
?/>


1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么可以在tabs組件里使用todo?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號