首页 > 解决方案 > 无法读取未定义的 Vue Firebase 的属性“推送”

问题描述

您好,当我推送表单时遇到问题,我在 Firebase 上检查我看到数据已推送但数据为空。

我将 firebase 配置文件导入到我的 ProfileInfo.vue 文件中。

import { db } from '../../config/db';

这是我使用的方法

AddProfile() {
        this.$firebaseRefs.Profile.push({
            firstName: this.profileData.firstName,
            lastName: this.profileData.lastName,
            phoneNumber: this.profileData.phoneNumber,
            adress: this.profileData.adress,
            gender: this.profileData.gender,
            personalEmail: this.profileData.personalEmail,
            companyName: this.profileData.companyName,
            chamberOfCommerceNumber: this.profileData.chamberOfCommerceNumber,
            street: this.profileData.street,
            houseNumber: this.profileData.houseNumber,
            zipCode: this.profileData.zipCode,
            location: this.profileData.location,
            companyEmail: this.profileData.companyEmail
        })
        this.profileData.firstName = '';
        this.profileData.lastName = '';
        this.profileData.phoneNumber = '';
        this.profileData.adress = '';
        this.profileData.gender = '';
        this.profileData.personalEmail = '';
        this.profileData.companyName = '';
        this.profileData.chamberOfCommerceNumber = '';
        this.profileData.street = '';
        this.profileData.houseNumber = '';
        this.profileData.zipCode = '';
        this.profileData.location = '';
        this.profileData.companyEmail = '';
        // this.$router.push('/internship')
        console.log('Added to database');
    }

现在我的 Firebare 中的数据是空的:

在此处输入图像描述

标签: javascriptfirebasevue.jsfirebase-realtime-database

解决方案


推荐阅读