From 9e28ea6485e318f6af28c2c342622bfe0371c95a Mon Sep 17 00:00:00 2001 From: dntzhang Date: Wed, 7 Nov 2018 17:24:34 +0800 Subject: [PATCH] eslint --- .../omi-mp/dist/src/mp/pages/index/index.js | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/omi-mp/dist/src/mp/pages/index/index.js b/packages/omi-mp/dist/src/mp/pages/index/index.js index 2e3ee109f..92a9935b4 100644 --- a/packages/omi-mp/dist/src/mp/pages/index/index.js +++ b/packages/omi-mp/dist/src/mp/pages/index/index.js @@ -1,12 +1,30 @@ import appCss from '../../app.wxss' import indexCss from './index.wxss' +import { h, define, WeElement } from 'omi' -function css(){ +function css() { return appCss + indexCss } -function render(){ - return h('view',{'class': `container`},[h('view',{'class': `userinfo`},[!hasUserInfo&&canIUse?h('button',{'open-type': `getUserInfo`,'bindgetuserinfo': `getUserInfo`},[`获取头像昵称`]):h('block',{},[h('image',{'bindtap': `bindViewTap`,'class': `userinfo-avatar`,'src': userInfo.avatarUrl,'mode': `cover`},[]),h('text',{'class': `userinfo-nickname`},[`${userInfo.nickName}`])])]),h('view',{'class': `usermotto`},[h('text',{'class': `user-motto`},[`${motto}`])])]) +function render() { + return ( + h('view', { 'class': `container` }, + [ + h('view', { 'class': `userinfo` }, + [!hasUserInfo && canIUse ? h('button', { 'open-type': `getUserInfo`, 'bindgetuserinfo': `getUserInfo` }, [`获取头像昵称`]) : h('block', {}, + [ + h('image', { 'bindtap': `bindViewTap`, 'class': `userinfo-avatar`, 'src': userInfo.avatarUrl, 'mode': `cover` }, []), + h('text', { 'class': `userinfo-nickname` }, + [`${userInfo.nickName}`]) + ]) + ]), + h('view', { 'class': `usermotto` }, + [ + h('text', { 'class': `user-motto` }, + [`${motto}`]) + ]) + ]) + ) } //index.js @@ -21,7 +39,7 @@ Page({ canIUse: wx.canIUse('button.open-type.getUserInfo') }, //事件处理函数 - bindViewTap: function() { + bindViewTap: function () { wx.navigateTo({ url: '../logs/logs' }) @@ -32,7 +50,7 @@ Page({ userInfo: app.globalData.userInfo, hasUserInfo: true }) - } else if (this.data.canIUse){ + } else if (this.data.canIUse) { // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 app.userInfoReadyCallback = res => { @@ -54,7 +72,7 @@ Page({ }) } }, - getUserInfo: function(e) { + getUserInfo: function (e) { console.log(e) app.globalData.userInfo = e.detail.userInfo this.setData({ @@ -63,3 +81,5 @@ Page({ }) } }) + +define('my-app', render)