使用 Vuejs 修改 Firebase 中的数据

Modify data in Firebase with Vuejs

我刚开始学习Vuejs。尝试按照 https://alligator.io/vuejs/vuefire-firebase/(修改页面底部的数据部分)后,我尝试更新 Firebase 上的信息,但出现错误: 无法读取未定义的 属性 个子项。我怎样才能解决这个问题?

<script>
import {linesRef} from '../../firebase'
export default {
    firebase: {
        lines: linesRef
    },
    data() {
        return {
            status: 'available'
        }
    },
    methods: {
        hold(key, e) {
            if (confirm("Hold the line?")) {
                function updateStatus(line, sold) {
                    linesRef.lines.child(line['.key'])
                    .child('status').set(sold)
                }
                e.currentTarget.style.backgroundColor = "yellow"

            }
            else{
                e.currentTarget.style.backgroundColor = "transparent"
            }
        }
    }
}
</script>

您必须写 linesRef.child(line['.key']) 才能访问您想要的文档