// components/div-personal/index.js const Nova = getApp().Nova; const Parse = getApp().Parse; Component({ /** * 组件的属性列表 */ properties: { options: null, }, /** * 组件的初始数据 */ data: { portrait: "//b.yzcdn.cn/showcase/membercenter/2018/08/06/default_avatar@2x.png", user: null }, /** * 组件的方法列表 */ async created() { }, async attached() { await this.getUser() }, pageLifetimes: { show: async function () { await this.getUser() } }, ready: function () { // 在组件布局完成后执行,确保options参数中有data信息 this.loadData(); }, methods: { async loadData() { await Nova.checkComponentsDataProperties(this); // let list = await Nova.getBlockData(this.data.options.data); let { options } = this.data; console.log("个人页面组", options); let { style } = options; this.setData({ style }); }, async getUser() { const current = Parse && Parse.User && typeof Parse.User.current === 'function' ? Parse.User.current() : null const cuid = current && current.id ? current.id : '' if (!cuid) return let User = new Parse.Query('_User') let user = await User.get(cuid) this.setData({ user: user.toJSON() }) } }, });