vueとfirestoreを用いて開発してます。
metbodsのなかに
changeData(){ this.query.forEach(que => { let stockjudge = this.dbconnection.collection('items').doc(que); stockjudge.update({ stock: false }) }) },
templateのなかに
<v-btn @click="changeData">button</v-btn>
queryはcomputedのなかにあり、配列を返す値です。ex)['aa','bb']
v-btnを押せばqueryにある要素のプロパティのstockがtrueからfalseへ変わるはずですが、変わりません。
どこに問題があるのでしょうか。
DBはfirestoreを使っています。構成は
collectionがitemsでdocumentに'aa'や'bb'があり、それぞれの'aa','bb'がフィールドとしてstock:trueという初期値を持ってます。
ちなみにコンソールのエラーメッセージは以下の2つです。
[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'collection' of null"
TypeError: Cannot read property 'collection' of null
あなたの回答
tips
プレビュー