我在login.vue
中提交了表单,该表单将称为submit()
。然后我在Web控制台中遇到错误。
未捕获的TypeError:无法读取未定义的属性'auth'
main.js
import Vue from 'vue'
import App from './App'
import router from './router'
import * as firebase from 'firebase/app'
import { firebaseConfig } from '@/firebaseConfig';
Vue.prototype.$firebase = firebase.initializeApp(firebaseConfig)
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
login.vue
const authService = {
methods: {
submit () {
this.$firebase.auth().signInWithEmailAndPassword(this.login.email, this.login.pass).then(
(user) =>{
this.$router.replace('bm')
}
)
}
}
}
答案 0 :(得分:1)
您还必须:
function ConvertDEGToDMS(deg, lat) {
var absolute = Math.abs(deg);
var degrees = Math.floor(absolute);
var minutesNotTruncated = (absolute - degrees) * 60;
var minutes = Math.floor(minutesNotTruncated);
var seconds = ((minutesNotTruncated - minutes) * 60).toFixed(2);
if (lat) {
var direction = deg >= 0 ? "N" : "S";
} else {
var direction = deg >= 0 ? "E" : "W";
}
return degrees + "°" + minutes + "'" + seconds + "\"" + direction;
}
在import 'firebase/auth'
导入后才能获得Firebase Auth产品功能。