i've just tried to integrate firebase custom config at Vue. I'm newbie at this and got error like this
I already add firebase sdk to my project. This is my main.js
Vue.config.productionTip = false
const config = {
apiKey: "######################",
authDomain: "######################",
databaseURL: "######################",
projectId: "######################",
storageBucket: "######################",
messagingSenderId: "######################",
appId: "######################",
measurementId: "######################"
};
firebase.initializeApp(config);
new Vue({
router,
vuetify,
render: h => h(App)
}).$mount('#app')
and I want to use firebase remote config on my View
<script>
import firebase from "firebase";
remoteConfig = firebase.remoteConfig();
// [START enable_dev_mode]
remoteConfig.settings = {
minimumFetchIntervalMillis: 3600000,
};
// [END enable_dev_mode]
// [START set_default_values]
remoteConfig.defaultConfig = ({
'is_auto_location': 'false',
});
// [END set_default_values]
remoteConfig.ensureInitialized()
.then(() => {
console.log('Firebase Remote Config is initialized');
setLocation();
})
.catch((err) => {
console.error('Firebase Remote Config failed to initialize', err);
});
function setLocation() {
this.isAutoLocation = remoteConfig.getString('is_auto_location');
}
</script>
please help. Thankyou
import firebase in main.js file import * as firebase from 'firebase'
there have an awesome vuejs package for firebase call vuefire . you can use it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.