提交 8c52b2db 编写于 作者: Q qiang

fix(x): 调整 iOS 平台 nativePage 初始化时机

上级 f749b70f
import { normalizeStyles, addLeadingSlash, invokeArrayFns, LINEFEED, SCHEME_RE, DATA_RE, cacheStringFunction, parseQuery, Emitter, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, ON_ERROR, ON_SHOW, ON_HIDE, removeLeadingSlash, getLen, EventChannel, once, ON_UNLOAD, ON_READY, parseUrl, ON_BACK_PRESS, ON_LAUNCH } from "@dcloudio/uni-shared";
import { normalizeStyles, addLeadingSlash, invokeArrayFns, LINEFEED, SCHEME_RE, DATA_RE, cacheStringFunction, parseQuery, Emitter, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, ON_ERROR, ON_SHOW, ON_HIDE, removeLeadingSlash, getLen, EventChannel, once, ON_UNLOAD, ON_READY, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_RESIZE, parseUrl, ON_BACK_PRESS, ON_LAUNCH } from "@dcloudio/uni-shared";
import { extend, isString, isPlainObject, isFunction as isFunction$1, isArray, isPromise, hasOwn, remove, capitalize, toTypeString, toRawType, parseStringStyle } from "@vue/shared";
import { createVNode, render, injectHook, getCurrentInstance, defineComponent, warn, isInSSRComponentSetup, ref, watchEffect, computed, onMounted, camelize, onUnmounted, reactive, watch, nextTick } from "vue";
var _wks = { exports: {} };
......@@ -1784,6 +1784,15 @@ function registerPage(_ref, onCreated) {
nativePage.addPageEventListener(ON_READY, (_) => {
invokeHook(page, ON_READY);
});
nativePage.addPageEventListener(ON_PULL_DOWN_REFRESH, (_) => {
invokeHook(page, ON_PULL_DOWN_REFRESH);
});
nativePage.addPageEventListener(ON_REACH_BOTTOM, (_) => {
invokeHook(page, ON_REACH_BOTTOM);
});
nativePage.addPageEventListener(ON_RESIZE, (_) => {
invokeHook(page, ON_RESIZE);
});
var pageCSSStyle = page.$options.styles;
if (pageCSSStyle) {
loadFontFaceByStyles(pageCSSStyle, false);
......@@ -3296,8 +3305,7 @@ function initService(app) {
}
function initComponentInstance(app) {
app.mixin({
beforeMount() {
var _vm$$options$styles;
beforeCreate() {
var vm = this;
var instance = vm.$;
if (instance.type.mpType === "app") {
......@@ -3305,6 +3313,14 @@ function initComponentInstance(app) {
}
var pageId = instance.root.attrs.__pageId;
vm.$nativePage = getNativeApp().pageManager.findPageById(pageId + "");
},
beforeMount() {
var _vm$$options$styles;
var vm = this;
var instance = vm.$;
if (instance.type.mpType === "app") {
return;
}
loadFontFaceByStyles((_vm$$options$styles = vm.$options.styles) !== null && _vm$$options$styles !== void 0 ? _vm$$options$styles : [], false);
}
});
......@@ -3940,7 +3956,6 @@ const radio = /* @__PURE__ */ defineBuiltInComponent({
class: UniRadioElement
},
props: radioProps,
styles: styleList,
setup(props, _ref) {
var {
slots,
......
......@@ -4,7 +4,7 @@ import { loadFontFaceByStyles } from '../utils'
export function initComponentInstance(app: App) {
app.mixin({
beforeMount(this: ComponentPublicInstance) {
beforeCreate(this: ComponentPublicInstance) {
const vm = this
const instance = vm.$
if ((instance.type as any).mpType === 'app') {
......@@ -12,7 +12,13 @@ export function initComponentInstance(app: App) {
}
const pageId = instance.root.attrs.__pageId
vm.$nativePage = getNativeApp().pageManager.findPageById(pageId + '')
},
beforeMount(this: ComponentPublicInstance) {
const vm = this
const instance = vm.$
if ((instance.type as any).mpType === 'app') {
return
}
loadFontFaceByStyles(vm.$options.styles ?? [], false)
},
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册