import { WeApp } from '../../common/common' ; const app = getApp ( ) as WeApp ; interface IndexPageData { motto : string ; userInfo : wx . IData ; } interface IndexPage extends IPage { } class IndexPage { public data : IndexPageData = { motto : 'Hello World' , userInfo : { } } ; public bindViewTap ( ) { wx . navigateTo ( { url : '../logs/logs' } ) ; } public onLoad ( ) { console . log ( 'onLoad' ) ; app . getUserInfo ( info => { this . setData ( { userInfo : info } ) ; } ) ; } } Page ( new IndexPage ( ) ) ;