优化:精简个人信息头像卡
This commit is contained in:
@@ -83,7 +83,13 @@ Page({
|
||||
},
|
||||
|
||||
onInput(event) {
|
||||
this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value })
|
||||
const field = event.currentTarget.dataset.field
|
||||
const value = event.detail.value
|
||||
const nextData = { [`form.${field}`]: value }
|
||||
if (field === 'nickname') {
|
||||
nextData.avatarText = Array.from(String(value || '').trim())[0] || '用'
|
||||
}
|
||||
this.setData(nextData)
|
||||
},
|
||||
|
||||
async chooseAvatar() {
|
||||
@@ -101,10 +107,6 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
removeAvatar() {
|
||||
if (!this.data.avatarUploading && !this.data.saving) this.setData({ 'form.avatar': '' })
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (this.data.saving || this.data.avatarUploading) return
|
||||
const form = this.data.form
|
||||
|
||||
Reference in New Issue
Block a user