@@ -270,9 +270,101 @@ interface AnyConstructor {
270270 prototype : any
271271}
272272
273+ export interface WebRouteConfig {
274+ /**
275+ * Web 路由模式。
276+ *
277+ * @default 'hash'
278+ */
279+ mode ?: 'hash' | 'history' | 'abstract'
280+
281+ /**
282+ * 应用的基路径。
283+ */
284+ base ?: string
285+
286+ /**
287+ * history 模式不可用时是否回退到 hash 模式。
288+ *
289+ * @default true
290+ */
291+ fallback ?: boolean
292+
293+ /**
294+ * 全局激活链接的 CSS 类名。
295+ */
296+ linkActiveClass ?: string
297+
298+ /**
299+ * 全局精确激活链接的 CSS 类名。
300+ */
301+ linkExactActiveClass ?: string
302+
303+ /**
304+ * 自定义查询字符串解析函数。
305+ */
306+ parseQuery ?: ( query : string ) => Record < string , any >
307+
308+ /**
309+ * 自定义查询参数序列化函数。
310+ */
311+ stringifyQuery ?: ( query : Record < string , any > ) => string
312+
313+ /**
314+ * 自定义页面滚动行为。
315+ */
316+ scrollBehavior ?: (
317+ to : Record < string , any > ,
318+ from : Record < string , any > ,
319+ savedPosition : { x : number ; y : number } | null
320+ ) => any
321+
322+ [ key : string ] : any
323+ }
324+
273325export interface WebviewConfig {
326+ /**
327+ * 允许加载的 H5 域名白名单。
328+ */
274329 hostWhitelists ?: Array < string >
275- apiImplementations ?: object
330+
331+ /**
332+ * WebView 调用的宿主 API 实现。
333+ */
334+ apiImplementations ?: Record < string , ( ...args : Array < any > ) => any >
335+ }
336+
337+ export interface WebConfig {
338+ /**
339+ * Web 路由配置。
340+ */
341+ routeConfig ?: WebRouteConfig
342+
343+ /**
344+ * 是否禁用页面切换动画。
345+ *
346+ * @deprecated 请使用编译阶段的 webConfig.disablePageTransition。
347+ */
348+ disablePageTransition ?: boolean
349+
350+ /**
351+ * 是否在 Web 输出时启用内置标题栏。
352+ *
353+ * @default false
354+ */
355+ enableTitleBar ?: boolean
356+
357+ /**
358+ * Android 设备上标题栏顶部安全区的高度,单位为 px。
359+ *
360+ * @default 24
361+ */
362+ safeAreaInsetTop ?: number
363+
364+ /**
365+ * WebView 宿主能力配置。
366+ */
367+ webviewConfig ?: WebviewConfig
276368}
277369
278370/**
@@ -459,14 +551,8 @@ interface MpxConfig {
459551 proxyEventHandler : ( e : WechatMiniprogram . CustomEvent , target : ComponentIns < { } , { } , { } , { } , [ ] > ) => void
460552 setDataHandler : ( data : object , target : ComponentIns < { } , { } , { } , { } , [ ] > ) => void
461553 forceFlushSync : boolean ,
462- webRouteConfig : object ,
463- webConfig : object ,
464- /*
465- * 支持两个属性
466- * hostWhitelists Array 类型 支持h5域名白名单安全校验
467- * apiImplementations webview JSSDK接口 例如getlocation
468- */
469- webviewConfig : WebviewConfig ,
554+ webRouteConfig : WebRouteConfig ,
555+ webConfig : WebConfig ,
470556 /** react-native 相关配置,用于挂载事件等,如 onShareAppMessage */
471557 rnConfig : RnConfig ,
472558}
0 commit comments