vuejs2 - 在firebase + Vue + Quasar中更改个人资料图片之前为用户设置默认图像
问题描述
我正在开发一个学生、教职员工和非教职员工可以访问的学校应用程序,我如何在 img src 中添加一个功能,为用户提供默认的个人资料图片,这样我创建的每个新用户都不会有空白图片来源
我的模板如下所示:
<q-avatar size="150px" class="q-mb-sm">
<q-img :loading="loading" :src="userDetails.image" />
</q-avatar>
我的州
email:"opeyemi@gmail.com"
image:undefined
name:"Opeyemi"
select:"Student"
userId:"4arS2LtESXb9u5uRjXcJl9u9prP2"
当然图像将返回未定义,我如何为新用户提交默认个人资料图片
我如何注册我的用户
registerUsers({}, payload) {
firebaseAuth.createUserWithEmailAndPassword(payload.email, payload.password)
.then(res => {
const userId = res.user.uid;
console.log(res)
Notify.create({
message: 'Regsitration Successful!.',
color: 'positive',
classes: 'quick'
})
//set user
firebaseDb.ref(`users/${userId}`).set({
name: payload.name,
email: payload.email,
select: payload.select
});
})
.catch(err => {
console.log(err)
Notify.create({
message: `${err.message}`,
classes: 'quick',
color: 'negative'
})
})
console.log(payload)
解决方案
推荐阅读
- angular - 动态添加验证器
- gcc - 创建 aarch64 裸机程序时如何防止“main.o:(.eh_frame+0x1c): relocation truncated to fit: R_AARCH64_PREL32 against `.text'”?
- apache-spark - Spark sql从字符串创建数据集
- javascript - 已超出 Jest Call 重试次数
- c# - 在联接查询中选择具有最小日期的行
- kubernetes - Pod 无需重启即可进入初始化状态
- anaconda - Anaconda 2020.02 安装出现问题
- ffmpeg - FFmpeg PNG覆盖在背景图像上的视频
- karate - 路径无效的文件上传不会失败测试
- reactjs - React - List?Dictionary?State? Or am i missing something