import { App , EachPage } from '../../../app' ; import Common from '../common' ; const app = getApp < App > ( ) ; interface Data { loadingState : Partial < Record < string , boolean > > ; navbarTitleVisible : boolean ; } const initialData = { loadingState : { } , navbarTitleVisible : false , } ; Page ( { ... Common , ... ( app . eachPage as EachPage < Data > ) , data : { ... app . eachPage . data , ... initialData } , onLoad ( query ) { this . onLoadOne ( query , '加载态' ) . commit ( ) ; } , setLoading ( { currentTarget : { dataset } } ) { this . setData ( { [ `loadingState.${ dataset . for }` ] : ! this . data . loadingState [ dataset . for ] } ) ; } , } ) ;