From 8965728459b94ad2459a9cfc5af97ce5e8708da9 Mon Sep 17 00:00:00 2001 From: mutoe Date: Thu, 20 Dec 2018 10:40:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(SPA):=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=88=9B=E5=BB=BA=E5=9C=88=E5=AD=90=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issue slimkit/plus#542 (cherry picked from commit 2e73eb68cc3e0351cf5bdaac70f91194a0c10185) # Conflicts: # resources/spa/src/components/form/FormAvatarItem.vue --- .../spa/src/components/form/FormAvatarItem.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/spa/src/components/form/FormAvatarItem.vue b/resources/spa/src/components/form/FormAvatarItem.vue index f4712ab79..baf68e715 100644 --- a/resources/spa/src/components/form/FormAvatarItem.vue +++ b/resources/spa/src/components/form/FormAvatarItem.vue @@ -10,8 +10,9 @@ @@ -24,10 +25,13 @@ export default { name: 'FormAvatarItem', components: { ImageUploader }, props: { - value: { type: null, default: null }, + value: { type: null, default: () => ({}) }, label: { type: String, default: '上传头像' }, readonly: { type: Boolean, default: false }, - + /** + * 文件类型 + */ + type: { type: String, default: 'storage', validator (type) { return ['blob', 'id', 'url', 'storage'].includes(type) } }, /** * 头像形状 square: 方形 circle: 圆形 */ @@ -35,7 +39,9 @@ export default { }, data () { return { - avatar: null, + avatar: this.type === 'storage' + ? this.$props.value.url + : this.$props.value, } }, methods: {