提交 0de4c69b 编写于 作者: Q qiang

feat(harmony): 初始化 WebView style

上级 3c96e87b
import { hasOwn } from '@vue/shared'
import type { RegisterPageOptions } from '@dcloudio/uni-app-plus/service/framework/page/register'
import { initRouteOptions } from '@dcloudio/uni-app-plus/service/framework/page/routeOptions'
import { createWebview } from '../webview'
import { createWebview, initWebview } from '../webview'
import {
ON_REACH_BOTTOM_DISTANCE,
type PageNodeOptions,
......@@ -35,11 +35,14 @@ export function registerPage({
routeOptions.meta.id = parseInt(webview.id!)
// TODO tabBar
if (__DEV__) {
console.log(formatLog('registerPage', path, webview.id))
}
// TODO initWebview
initWebview(webview, path, query, routeOptions.meta)
const route = path.slice(1)
;(webview as any).__uniapp_route = route
......
import type { CreateWebviewOptions } from '@dcloudio/uni-app-plus/service/framework/webview'
import { getWebviewId } from '@dcloudio/uni-app-plus/service/framework/webview/utils'
import { getPreloadWebview } from '@dcloudio/uni-app-plus/service/framework/webview/preload'
export * from './init'
export function createWebview(options: CreateWebviewOptions) {
if (getWebviewId() === 2) {
......
import { initWebviewStyle } from './style'
export function initWebview(
webview: PlusWebviewWebviewObject,
path: string,
query: Record<string, any>,
routeMeta: UniApp.PageRouteMeta
) {
initWebviewStyle(webview, path, query, routeMeta)
// TODO initWebviewEvent(webview)
}
import { formatLog } from '@dcloudio/uni-shared'
import { parseWebviewStyle } from '@dcloudio/uni-app-plus/service/framework/webview/style'
import {
initDebugRefresh,
initUniPageUrl,
} from '@dcloudio/uni-app-plus/service/framework/webview/utils'
export function initWebviewStyle(
webview: PlusWebviewWebviewObject,
path: string,
query: Record<string, any>,
routeMeta: UniApp.PageRouteMeta
) {
// TODO parseTheme
const getWebviewStyle = () => parseWebviewStyle(path, routeMeta, webview)
const webviewStyle = getWebviewStyle()
webviewStyle.uniPageUrl = initUniPageUrl(path, query)
const isTabBar = !!routeMeta.isTabBar
webviewStyle.debugRefresh = initDebugRefresh(isTabBar, path, query)
// TODO webviewStyle.locale
if (__DEV__) {
console.log(formatLog('updateWebview', webviewStyle))
}
// TODO useWebviewThemeChange
webview.setStyle(webviewStyle)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册