2017-12-11 14 views
0

私は、更新イベントが発生している。このVuefireどのようにセットアップのdb refに動的にコンポーネント小道具

export default { 
    name: 'data', 
    props: { 
    api: { 
     type: String 
    }, 
    section: { 
     type: String 
    } 
    }, 
    firebase: { 
    apiData: { 
     source: (console.log('source', this.api), db.ref(this.api)), 
     asObject: true 
    } 
    }, 
    updated: function() { 
    console.log('updated', this.api, this.section) 
    }, 
    created: function() { 
    console.log('created', this.api, this.section) 
    } 
} 

私の問題のように、部品データに基づいてfirebaseノードの結合の動的設定にしようとしているに基づいて変化し、 apiDataソースの更新は行われません。

vuefireでこれを行う正しい方法は何ですか?

答えて

0

vuefireドキュメントのいくつかの読みになった後、私はあなたが手の込んだてくださいすることができ

data: function(){ 
    return { 
    apiData: {} 
    } 
}, 
created: function() { 
    this.$bindAsObject('apiData', db.ref(this.api)) 
}, 
watch: { 
    api: function() { 
    this.$bindAsObject('apiData', db.ref(this.api)) 
    } 
} 
+0

時計の解決策を考え出しましたか?この時計の仕組みは何ですか?どこにドキュメントがありますか? – Notflip

関連する問題