我在嘗試制作一個簡單的 Vue3 Firebase 應用程式時遇到了一些麻煩。
問題是在匯入所需模塊時,其中兩個的呼叫方式相同:ref.
import { computed, defineComponent, ref } from "vue";
import { getDatabase, ref, child, get } from "firebase/database";
我需要這兩個 ref(s) 匯入,一個用于圖表,另一個用于 firebase 連接,但是,代碼不起作用,因為我收到錯誤Duplicate identifier "ref"
在控制臺中我看到:

其中,在 App.vue 的第 85 行中,我使用了 firebase 的 ref(但使用了 Vue 的模塊,而不是 firebase/database 的模塊)
uj5u.com熱心網友回復:
您是否嘗試使用import別名:
import { getDatabase, ref as fbRef, child, get } from "firebase/database";
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/463752.html
