mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-27 08:50:27 +00:00
[jsfw]sync bugs solved before
Signed-off-by: liwenzhen <liwenzhen3@huawei.com> Change-Id: I6119ab354b45f23b8bc5e6aeaf3a3ed90fa815e5
This commit is contained in:
parent
9e56d1e8a4
commit
bf18f4cff5
@ -393,7 +393,7 @@ function parseDeviceTypeCondition(condition: string, mediaStatus: object, failRe
|
||||
return mediaStatus['device-type'] === 'phone';
|
||||
} else {
|
||||
return deviceType[1] === mediaStatus['device-type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,7 +441,7 @@ function compileRepeat(vm: Vm, target: TemplateInterface, dest: Element): void {
|
||||
getter = repeat.exp;
|
||||
key = repeat.key || '$idx';
|
||||
value = repeat.value;
|
||||
trackBy = repeat.tid;
|
||||
trackBy = target.attr && target.attr.tid;
|
||||
} else {
|
||||
getter = repeat;
|
||||
key = '$idx';
|
||||
|
@ -52,6 +52,28 @@ export class Evt {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override toJSON function to fix version compatibility issues.
|
||||
*/
|
||||
toJSON() {
|
||||
const jsonObj: Record<string, any> = {};
|
||||
for (const p in this) {
|
||||
if (!p.startsWith('_')) {
|
||||
jsonObj[p as string] = this[p];
|
||||
}
|
||||
}
|
||||
const proto = Object.getPrototypeOf(this);
|
||||
const protoNames = Object.getOwnPropertyNames(proto);
|
||||
for (const key of protoNames) {
|
||||
const desc = Object.getOwnPropertyDescriptor(proto, key);
|
||||
const hasGetter = desc && typeof desc.get === 'function';
|
||||
if (hasGetter) {
|
||||
jsonObj[key] = this[key];
|
||||
}
|
||||
}
|
||||
return jsonObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop dispatch and broadcast.
|
||||
*/
|
||||
|
@ -78,7 +78,7 @@ import {
|
||||
* @param {ExternalEvent} externalEvents - External events.
|
||||
*/
|
||||
export default class Vm {
|
||||
private _$app: any;
|
||||
private $app: any;
|
||||
private __methods: Record<string, (...args: unknown[]) => any>;
|
||||
private __type: string;
|
||||
private __css: cssType;
|
||||
@ -104,7 +104,7 @@ export default class Vm {
|
||||
private readonly __descriptor: string;
|
||||
private __isHide: boolean;
|
||||
private __mediaStatus: Partial<MediaStatusInterface<string, boolean>>;
|
||||
private _$refs: Record<string, Element>;
|
||||
public $refs: Record<string, Element>;
|
||||
private __slotContext: { content: Record<string, any>, parentVm: Vm };
|
||||
private __counterMapping = new Map();
|
||||
|
||||
@ -116,7 +116,7 @@ export default class Vm {
|
||||
mergedData: object,
|
||||
externalEvents: ExternalEvent
|
||||
) {
|
||||
this._$app = global.aceapp;
|
||||
this.$app = global.aceapp;
|
||||
this.__parent = parentVm.__realParent ? parentVm.__realParent : parentVm;
|
||||
this.__app = parentVm.__app;
|
||||
parentVm.__childrenVms && parentVm.__childrenVms.push(this);
|
||||
@ -131,7 +131,7 @@ export default class Vm {
|
||||
this.__css = options.style;
|
||||
this.__selector = selector(this.__css);
|
||||
this.__ids = {};
|
||||
this._$refs = {};
|
||||
this.$refs = {};
|
||||
this.__vmEvents = {};
|
||||
this.__childrenVms = [];
|
||||
this.__type = type;
|
||||
@ -486,7 +486,7 @@ export default class Vm {
|
||||
delete this.__parent;
|
||||
delete this.__parentEl;
|
||||
delete this.__rootEl;
|
||||
delete this._$refs;
|
||||
delete this.$refs;
|
||||
|
||||
// Destroy child vms recursively.
|
||||
if (this.__childrenVms) {
|
||||
@ -527,14 +527,6 @@ export default class Vm {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* $app function.
|
||||
* @return {*} - aceapp.
|
||||
*/
|
||||
public get $app(): any {
|
||||
return this._$app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methods of this Vm.
|
||||
* @type {Object}
|
||||
@ -817,15 +809,6 @@ export default class Vm {
|
||||
this.__mediaStatus = newMediaStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* $refs of this Vm.
|
||||
* @type {[key: string]: Element}
|
||||
* @readonly
|
||||
*/
|
||||
public get $refs() {
|
||||
return this._$refs;
|
||||
}
|
||||
|
||||
/**
|
||||
* slotContext of this Vm.
|
||||
* @type { content: Record<string, any>, parentVm: Vm }
|
||||
|
Loading…
Reference in New Issue
Block a user