从 Firebase
获取数据时,我正在尝试设置 properties
的 object
获得的数据,但当我尝试更改数据和 UI 时它抛出这个错误。
v-on 处理程序中的错误:“TypeError:无法使用‘in’运算符在 null 中搜索‘cc’。
我在开发模式下使用 Vue 以及 Firebase
。我是否遗漏了任何概念?
beforeCreate(){
sref.get().then(sc => {
if (sc.exists) {
console.log(sc.data()); //this logs in the correct data
this.school = sc.data(); //this too
this.cc = sc.data().cc; //also this
this.name = sc.data().name;
当我做
console.log(this.name)
在 created()
它显示未定义,任何更改或更新的尝试也会出错
Vue warn]: Cannot set reactive property on undefined, null, or primitive value: null
[Vue warn]: Error in v-on handler: "TypeError: Cannot use 'in' operator to search for 'cc' in null"
found in
---> <VSelect>
<VForm>
<VCard>
TypeError: Cannot use 'in' operator to search for 'cc' in null
at Proxy.set
原文由 Aditya 发布,翻译遵循 CC BY-SA 4.0 许可协议
I figured out where I went wrong there, in my template
v-model
i was usingthis.school
,this.name
,this.cc
which was causing the warnings来,但我仍然不清楚工作的内部。我想如果有人指出我正确的资源。