#動的ルートマッチングについて
{ path: "/mypage/:uid", name: "Mypage", component: Mypage, meta: { requiresAuth: true }, },
signUp() { firebase .auth() .createUserWithEmailAndPassword(this.email, this.password) .then((userCredential) => { this.$swal("登録に成功しました。", { icon: "success", }); this.uid = userCredential.user.uid; return firebase .firestore() .collection("users") .doc(userCredential.user.uid) .set({ name: this.name, time: firebase.firestore.FieldValue.serverTimestamp(), uid: userCredential.user.uid, }); }) .then(() => { this.$router.push(`/mypage/${this.uid}`); })
下記にあるようにthis.$router.push(/mypage/${this.uid}
);と記載することで
routerにて指定した/mypage/:uidの「uid」を取得する認識ですが、
このuidのデータはどこから取得しているのでしょうか。
this.$router.push(`/mypage/${this.uid}`);
実際はFirestoreの「users」というコレクションを設けており、そのuidを取得しているのですが
Firestoreのデータを参照して取得するには下記が必要お認識しており、
.firestore().collection("users").doc()
上記を指定してあげてから使用することが必須になるのでしょうか。
**{{ $route.params.uid }}**にあるuidがどこから取得しているのか知りたいです。。
分かる方いらっしゃいましたらお力添えを頂きたいです。
宜しくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。