提交 2d49fd9e 编写于 作者: fxy060608's avatar fxy060608

fix(stat): lifecycle

上级 e99d6c92
......@@ -2671,6 +2671,9 @@ var serviceContext = (function (vue) {
openMapApp(ctx, args) {
return invokeVmMethod(ctx, 'openMapApp', args);
},
on(ctx, args) {
return ctx.on(args.name, args.callback);
},
};
function operateMap(id, pageId, type, data, operateMapCallback) {
const page = getCurrentPages().find((page) => page.$page.id === pageId);
......@@ -9947,16 +9950,39 @@ var serviceContext = (function (vue) {
return plus.maps.getMapById(this.pageId + '-map-' + this.id);
}
}
addCustomLayer() { }
removeCustomLayer() { }
addGroundOverlay() { }
removeGroundOverlay() { }
updateGroundOverlay() { }
initMarkerCluster() { }
addMarkers() { }
removeMarkers() { }
moveAlong() { }
openMapApp() { }
addCustomLayer(options) {
operateMapWrap(this.id, this.pageId, 'addCustomLayer', options);
}
removeCustomLayer(options) {
operateMapWrap(this.id, this.pageId, 'removeCustomLayer', options);
}
addGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, 'addGroundOverlay', options);
}
removeGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, 'removeGroundOverlay', options);
}
updateGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, 'updateGroundOverlay', options);
}
initMarkerCluster(options) {
operateMapWrap(this.id, this.pageId, 'initMarkerCluster', options);
}
addMarkers(options) {
operateMapWrap(this.id, this.pageId, 'addMarkers', options);
}
removeMarkers(options) {
operateMapWrap(this.id, this.pageId, 'removeMarkers', options);
}
moveAlong(options) {
operateMapWrap(this.id, this.pageId, 'moveAlong', options);
}
openMapApp(options) {
operateMapWrap(this.id, this.pageId, 'openMapApp', options);
}
on(options) {
operateMapWrap(this.id, this.pageId, 'on', options);
}
}
const createMapContext = defineSyncApi(API_CREATE_MAP_CONTEXT, (id, context) => {
if (context) {
......
......@@ -14,6 +14,8 @@ import animation from './animation'
export const defineBuiltInComponent: typeof defineComponent = (
options: any
) => {
// 标记为保留组件,这样框架其他地方可以据此来识别,比如 onLoad 等生命周期的注入会忽略系统保留组件
options.__reserved = true
// TODO 可能会补充特殊标记
const { props, mixins } = options
// 补充内置组件animation
......@@ -28,6 +30,8 @@ export const defineBuiltInComponent: typeof defineComponent = (
* @returns
*/
export const defineSystemComponent: typeof defineComponent = (options: any) => {
// 标记为保留组件
options.__reserved = true
;(options as ComponentOptions).compatConfig = {
MODE: 3, // 标记为vue3
}
......
......@@ -3842,6 +3842,10 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
if (target) {
// fixed by xxxxxx
if (uniShared.isRootHook(type)) {
// 系统保留组件,如 view,app 等
if (target.type.__reserved) {
return;
}
target = target.root;
}
const hooks = target[type] || (target[type] = []);
......
......@@ -3867,6 +3867,10 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
if (target) {
// fixed by xxxxxx
if (isRootHook(type)) {
// 系统保留组件,如 view,app 等
if (target.type.__reserved) {
return;
}
target = target.root;
}
const hooks = target[type] || (target[type] = []);
......
......@@ -602,6 +602,7 @@ var animation = {
}
};
const defineBuiltInComponent = (options) => {
options.__reserved = true;
const { props: props2, mixins } = options;
if (!props2 || !props2.animation) {
(mixins || (options.mixins = [])).push(animation);
......@@ -609,6 +610,7 @@ const defineBuiltInComponent = (options) => {
return defineSystemComponent(options);
};
const defineSystemComponent = (options) => {
options.__reserved = true;
options.compatConfig = {
MODE: 3
};
......@@ -823,50 +825,51 @@ function useProvideLabel() {
});
return handlers;
}
const buttonProps = {
id: {
type: String,
default: ""
},
hoverClass: {
type: String,
default: "button-hover"
},
hoverStartTime: {
type: [Number, String],
default: 20
},
hoverStayTime: {
type: [Number, String],
default: 70
},
hoverStopPropagation: {
type: Boolean,
default: false
},
disabled: {
type: [Boolean, String],
default: false
},
formType: {
type: String,
default: ""
},
openType: {
type: String,
default: ""
},
loading: {
type: [Boolean, String],
default: false
},
plain: {
type: [Boolean, String],
default: false
}
};
var index$C = /* @__PURE__ */ defineBuiltInComponent({
name: "Button",
props: {
id: {
type: String,
default: ""
},
hoverClass: {
type: String,
default: "button-hover"
},
hoverStartTime: {
type: [Number, String],
default: 20
},
hoverStayTime: {
type: [Number, String],
default: 70
},
hoverStopPropagation: {
type: Boolean,
default: false
},
disabled: {
type: [Boolean, String],
default: false
},
formType: {
type: String,
default: ""
},
openType: {
type: String,
default: ""
},
loading: {
type: [Boolean, String],
default: false
},
plain: {
type: [Boolean, String],
default: false
}
},
props: buttonProps,
setup(props2, {
slots
}) {
......
......@@ -1634,6 +1634,7 @@ var animation = {
}
};
const defineBuiltInComponent = (options) => {
options.__reserved = true;
const { props: props2, mixins } = options;
if (!props2 || !props2.animation) {
(mixins || (options.mixins = [])).push(animation);
......@@ -1641,6 +1642,7 @@ const defineBuiltInComponent = (options) => {
return defineSystemComponent(options);
};
const defineSystemComponent = (options) => {
options.__reserved = true;
options.compatConfig = {
MODE: 3
};
......@@ -1909,50 +1911,51 @@ function _removeListeners(id2, listeners2, watch2) {
}
});
}
const buttonProps = {
id: {
type: String,
default: ""
},
hoverClass: {
type: String,
default: "button-hover"
},
hoverStartTime: {
type: [Number, String],
default: 20
},
hoverStayTime: {
type: [Number, String],
default: 70
},
hoverStopPropagation: {
type: Boolean,
default: false
},
disabled: {
type: [Boolean, String],
default: false
},
formType: {
type: String,
default: ""
},
openType: {
type: String,
default: ""
},
loading: {
type: [Boolean, String],
default: false
},
plain: {
type: [Boolean, String],
default: false
}
};
var index$y = /* @__PURE__ */ defineBuiltInComponent({
name: "Button",
props: {
id: {
type: String,
default: ""
},
hoverClass: {
type: String,
default: "button-hover"
},
hoverStartTime: {
type: [Number, String],
default: 20
},
hoverStayTime: {
type: [Number, String],
default: 70
},
hoverStopPropagation: {
type: Boolean,
default: false
},
disabled: {
type: [Boolean, String],
default: false
},
formType: {
type: String,
default: ""
},
openType: {
type: String,
default: ""
},
loading: {
type: [Boolean, String],
default: false
},
plain: {
type: [Boolean, String],
default: false
}
},
props: buttonProps,
setup(props2, {
slots
}) {
......@@ -3094,25 +3097,38 @@ class MapContext {
}
$getAppMap() {
}
addCustomLayer() {
addCustomLayer(options) {
operateMapWrap(this.id, this.pageId, "addCustomLayer", options);
}
removeCustomLayer(options) {
operateMapWrap(this.id, this.pageId, "removeCustomLayer", options);
}
removeCustomLayer() {
addGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, "addGroundOverlay", options);
}
addGroundOverlay() {
removeGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, "removeGroundOverlay", options);
}
removeGroundOverlay() {
updateGroundOverlay(options) {
operateMapWrap(this.id, this.pageId, "updateGroundOverlay", options);
}
updateGroundOverlay() {
initMarkerCluster(options) {
operateMapWrap(this.id, this.pageId, "initMarkerCluster", options);
}
initMarkerCluster() {
addMarkers(options) {
operateMapWrap(this.id, this.pageId, "addMarkers", options);
}
addMarkers() {
removeMarkers(options) {
operateMapWrap(this.id, this.pageId, "removeMarkers", options);
}
removeMarkers() {
moveAlong(options) {
operateMapWrap(this.id, this.pageId, "moveAlong", options);
}
moveAlong() {
openMapApp(options) {
operateMapWrap(this.id, this.pageId, "openMapApp", options);
}
openMapApp() {
on(options) {
operateMapWrap(this.id, this.pageId, "on", options);
}
}
const createMapContext = /* @__PURE__ */ defineSyncApi(API_CREATE_MAP_CONTEXT, (id2, context) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册