diff --git a/packages/mars-core/types/index.d.ts b/packages/mars-core/types/index.d.ts index 57e9d98d..5b65e864 100644 --- a/packages/mars-core/types/index.d.ts +++ b/packages/mars-core/types/index.d.ts @@ -1,14 +1,25 @@ export {default as Vue, PropType} from './vue/index'; import Vue from './vue/index'; -import {swanApp, marsApis} from './mars'; -export {swanApp} from './mars'; +import { + swanApp, + marsApis +} from './mars'; +export { + swanApp, + backgroundAudioManager +} from './mars'; // 补充 this. 上的属性和方法 declare module './vue/vue' { interface Vue { $myProperty: string; $mpUpdated: (cb?: Function) => Promise; - $api: marsApis + $api: marsApis; + $mp: { + options: any; + query: any; + scope: any; + } } } @@ -18,6 +29,8 @@ declare module './vue/options' { onLoad?: Function; onReady?: Function; onHide?: Function; - config?: any + onLaunch?: Function; + config?: any; + onShow?: Function; } } diff --git a/packages/mars-core/types/mars.d.ts b/packages/mars-core/types/mars.d.ts index c819c775..af50f2b6 100644 --- a/packages/mars-core/types/mars.d.ts +++ b/packages/mars-core/types/mars.d.ts @@ -3,7 +3,8 @@ import { swanApiOptionsNavigateToSmartProgram, swanApiOptionsGetStorage, backgroundAudioManager, - swanApiOptionsRecognizeImage + swanApiOptionsRecognizeImage, + swanApiOptionsSetKeepScreenOn } from './swan'; declare global { const getApp: () => swanApp; @@ -15,11 +16,15 @@ export interface swanApp { $api: marsApis; } +export { + backgroundAudioManager +} from './swan'; + export interface marsApis { navigateToSmartProgram: (options: swanApiOptionsNavigateToSmartProgram) => Promise; getStorage: (options: swanApiOptionsGetStorage) => Promise; setStorage: (options: any) => Promise; - getBackgroundAudioManager: () => Promise; + getBackgroundAudioManager: () => backgroundAudioManager; request: (options: any) => Promise; login: (options?: any) => Promise; showModal: (options?: any) => Promise; @@ -42,11 +47,11 @@ export interface marsApis { }[]; } }>; - createSelectorQuery: () => { select: (options?: any) => { boundingClientRect: () => void; }, exec: (options?: any) => void; }; + setKeepScreenOn: (options?: swanApiOptionsSetKeepScreenOn) => Promise; } \ No newline at end of file diff --git a/packages/mars-core/types/swan.d.ts b/packages/mars-core/types/swan.d.ts index 75e91086..4ec6cf65 100644 --- a/packages/mars-core/types/swan.d.ts +++ b/packages/mars-core/types/swan.d.ts @@ -37,6 +37,10 @@ export interface swanApiOptionsShowLoading extends swanApiOptionsBase { mask?: boolean; } +export interface swanApiOptionsSetKeepScreenOn extends swanApiOptionsBase { + keepScreenOn: boolean; +} + export interface swanApiOptionsShowToast extends swanApiOptionsBase { title: string; icon?: string;