提交 8b51fd33 编写于 作者: fxy060608's avatar fxy060608

wip(app): uni.getCurrentSubNVue

上级 2880d337
......@@ -1460,6 +1460,9 @@ function initRouteMeta(pageMeta, id) {
(navigationBar.titleText = '');
return res;
}
function normalizeSubNVueStyle(style) {
return JSON.parse(rpx2px(JSON.stringify(style), true));
}
function normalizePullToRefreshRpx(pullToRefresh) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset);
......@@ -17429,7 +17432,7 @@ function initSubNVues(webview, path, routeMeta) {
if (!subNVue.path) {
return;
}
const style = subNVue.style || {};
const style = normalizeSubNVueStyle((subNVue.style || {}));
const isNavigationBar = subNVue.type === 'navigationBar';
const isPopup = subNVue.type === 'popup';
style.uniNView = {
......
......@@ -3,6 +3,7 @@ import { getStatusbarHeight } from '../../../../helpers/statusBar'
import { isTabBarPage } from '../../../../helpers/plus'
import tabBar from '../../app/tabBar'
import { backbuttonListener } from '../../app/utils'
import { normalizeSubNVueStyle } from '@dcloudio/uni-core'
interface Extras {
__uniapp_host: string
......@@ -34,7 +35,9 @@ export function initSubNVues(
viewport?: number
}
}
const style: StyleExt = (subNVue.style as StyleExt) || {}
const style: StyleExt = normalizeSubNVueStyle(
(subNVue.style || {}) as Record<string, unknown>
)
const isNavigationBar = subNVue.type === 'navigationBar'
const isPopup = subNVue.type === 'popup'
......
......@@ -9,6 +9,7 @@ export function initAppProvide() {
crypto: cryptoDefine,
'window.crypto': cryptoDefine,
'global.crypto': cryptoDefine,
'uni.getCurrentSubNVue': ['@dcloudio/uni-app', 'getCurrentSubNVue'],
}
}
......
......@@ -108,6 +108,10 @@ export function initRouteMeta(
return res
}
export function normalizeSubNVueStyle(style: Record<string, unknown>) {
return JSON.parse(rpx2px(JSON.stringify(style), true))
}
export function normalizePullToRefreshRpx(
pullToRefresh: UniApp.PageRefreshOptions
) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册