提交 43c94c49 编写于 作者: fxy060608's avatar fxy060608

fix(app): debug refresh

上级 56b1c32b
......@@ -16,10 +16,14 @@ const defaultRoute = 'pages/index/index'
describe('webviewStyle', () => {
test('basic', () => {
expect(
parseWebviewStyle(defaultPath, {
route: defaultRoute,
navigationBar: {},
})
parseWebviewStyle(
defaultPath,
{
route: defaultRoute,
navigationBar: {},
},
{ id: '2' } as any
)
).toMatchSnapshot()
})
})
......@@ -17374,7 +17374,7 @@ var serviceContext = (function (vue) {
};
}
function parseWebviewStyle(path, routeMeta) {
function parseWebviewStyle(path, routeMeta, webview) {
const webviewStyle = {
bounce: 'vertical',
};
......@@ -17384,7 +17384,10 @@ var serviceContext = (function (vue) {
routeMeta[name];
}
});
initNVue(webviewStyle, routeMeta, path);
if (webview.id !== '1') {
// 首页 nvue 已经在 manifest.json 中设置了 uniNView,不能再次设置,否则会二次加载
initNVue(webviewStyle, routeMeta, path);
}
initPopGesture(webviewStyle, routeMeta);
initBackgroundColor(webviewStyle, routeMeta);
initTitleNView(webviewStyle, routeMeta);
......@@ -17724,7 +17727,7 @@ var serviceContext = (function (vue) {
}
function initWebviewStyle(webview, path, query, routeMeta) {
const webviewStyle = parseWebviewStyle(path, routeMeta);
const webviewStyle = parseWebviewStyle(path, routeMeta, webview);
webviewStyle.uniPageUrl = initUniPageUrl(path, query);
const isTabBar = !!routeMeta.isTabBar;
if (!routeMeta.isNVue) {
......@@ -17831,8 +17834,7 @@ var serviceContext = (function (vue) {
function initWebview(webview, path, query, routeMeta) {
// 首页或非 nvue 页面
if (webview.id === '1' || !routeMeta.isNVue) {
// path 必须参数为空,因为首页已经在 manifest.json 中设置了 uniNView,不能再次设置,否则会二次加载
initWebviewStyle(webview, '', query, routeMeta);
initWebviewStyle(webview, path, query, routeMeta);
}
initSubNVues(webview, path, routeMeta);
initWebviewEvent(webview);
......
......@@ -10,8 +10,7 @@ export function initWebview(
) {
// 首页或非 nvue 页面
if (webview.id === '1' || !routeMeta.isNVue) {
// path 必须参数为空,因为首页已经在 manifest.json 中设置了 uniNView,不能再次设置,否则会二次加载
initWebviewStyle(webview, '', query, routeMeta)
initWebviewStyle(webview, path, query, routeMeta)
}
initSubNVues(webview, path, routeMeta)
initWebviewEvent(webview)
......
......@@ -8,7 +8,7 @@ export function initWebviewStyle(
query: Record<string, any>,
routeMeta: UniApp.PageRouteMeta
) {
const webviewStyle = parseWebviewStyle(path, routeMeta)
const webviewStyle = parseWebviewStyle(path, routeMeta, webview)
webviewStyle.uniPageUrl = initUniPageUrl(path, query)
const isTabBar = !!routeMeta.isTabBar
if (!routeMeta.isNVue) {
......
......@@ -7,7 +7,8 @@ import { DebugRefresh, InitUniPageUrl } from '../utils'
export function parseWebviewStyle(
path: string,
routeMeta: UniApp.PageRouteMeta
routeMeta: UniApp.PageRouteMeta,
webview: PlusWebviewWebviewObject
): PlusWebviewWebviewStyles & {
uniPageUrl?: InitUniPageUrl
debugRefresh?: DebugRefresh
......@@ -24,7 +25,10 @@ export function parseWebviewStyle(
routeMeta[name as keyof UniApp.PageRouteMeta]
}
})
initNVue(webviewStyle, routeMeta, path)
if (webview.id !== '1') {
// 首页 nvue 已经在 manifest.json 中设置了 uniNView,不能再次设置,否则会二次加载
initNVue(webviewStyle, routeMeta, path)
}
initPopGesture(webviewStyle, routeMeta)
initBackgroundColor(webviewStyle, routeMeta)
initTitleNView(webviewStyle, routeMeta)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册