Przeglądaj źródła

零售端-修改昵称要显示当前昵称

ouyang 16 godzin temu
rodzic
commit
93a98737cf
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      mallApp/src/pages/user/edit.vue

+ 7 - 1
mallApp/src/pages/user/edit.vue

@@ -77,10 +77,16 @@ export default {
 		init(){
 			//this.getLoginInfo();
 		},
+		/**
+		 * 拉取当前登录用户信息:回填生日展示,并把已有昵称写入 form.name 供输入框渲染
+		 */
 		getLoginInfo(){
 			currentInfo().then(res=>{
 				if(res.code == 1){
-					this.userInfo = res.data.info?res.data.info:[]
+					const info = res.data && res.data.info ? res.data.info : {}
+					this.userInfo = info
+					// 昵称绑定在 form.name,未赋值时输入框一直空白
+					this.form.name = info.name != null ? String(info.name) : ''
 				}
 			})
 		},