【问题标题】:Having a hard time with async vue router to vue fire使用异步 vue 路由器很难触发 vue
【发布时间】:2016-11-22 07:29:56
【问题描述】:

我使用 vue fire 作为插件连接到 firebase,很容易与 VUE JS 和 VUE 路由器集成

我真的很难在手动绑定后解决 null 的事情

喜欢这个

代码行

bindUser() {
 this.$bindAsArray('buser',this.$firebaseRefs.busers.orderByChild('uid').equalTo(this.uid));
},

并正确路由

使用这个

toDashboard() {
    this.$router.push(`user/${this.buser[0].username}`)

},

为什么它总是一个空值?请在这里帮助我

【问题讨论】:

    标签: firebase-realtime-database vue.js vue-router


    【解决方案1】:

    需要手动$bindAsArray吗?你在你的组件选项上试过这个吗?

    firebase() {
        debugger // make sure $this.$firebaseRefs.busers... is what you expect
        return {
            buser: this.$firebaseRefs.busers.orderByChild('uid').equalTo(this.uid)
        }
    }
    

    你也在使用Vue DevTools吗?这应该可以帮助您检查绑定。

    【讨论】:

      猜你喜欢
      • 2018-01-07
      • 1970-01-01
      • 2021-02-08
      • 2017-04-10
      • 2019-11-04
      • 2019-05-02
      • 2018-11-17
      • 2016-09-08
      • 1970-01-01
      相关资源
      最近更新 更多