render-core 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/class/component.d.ts +2 -3
- package/class/component.js +11 -11
- package/class/pageController.js +2 -0
- package/library/render/render.js +2 -2
- package/package.json +1 -1
package/class/component.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class Component implements RenderBase {
|
|
|
17
17
|
private readonly name;
|
|
18
18
|
private readonly template;
|
|
19
19
|
private readonly props?;
|
|
20
|
-
private readonly data
|
|
20
|
+
private readonly data?;
|
|
21
21
|
private readonly methods?;
|
|
22
22
|
private readonly computed?;
|
|
23
23
|
private readonly watcher?;
|
|
@@ -31,11 +31,10 @@ export declare class Component implements RenderBase {
|
|
|
31
31
|
name: string;
|
|
32
32
|
template: string;
|
|
33
33
|
props?: {} | string[];
|
|
34
|
-
data?:
|
|
34
|
+
data?: {};
|
|
35
35
|
computed?: {};
|
|
36
36
|
methods?: {};
|
|
37
37
|
watcher?: {};
|
|
38
|
-
executor?: {};
|
|
39
38
|
beforeRender?: () => void;
|
|
40
39
|
afterRender?: () => void;
|
|
41
40
|
beforeUpdate?: () => void;
|
package/class/component.js
CHANGED
|
@@ -5,72 +5,72 @@ var Component = /** @class */ (function () {
|
|
|
5
5
|
//标签模板样式
|
|
6
6
|
this.template = config.template;
|
|
7
7
|
//添加数据
|
|
8
|
-
if (typeof config.props
|
|
8
|
+
if (typeof config.props === "undefined") {
|
|
9
9
|
this.props = [];
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
12
|
this.props = config.props;
|
|
13
13
|
}
|
|
14
14
|
//添加数据
|
|
15
|
-
if (typeof config.data
|
|
15
|
+
if (typeof config.data === "undefined") {
|
|
16
16
|
this.data = {};
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
this.data = config.data;
|
|
20
20
|
}
|
|
21
21
|
//添加计算属性
|
|
22
|
-
if (config.computed
|
|
22
|
+
if (config.computed === "undefined") {
|
|
23
23
|
this.computed = {};
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
this.computed = config.computed;
|
|
27
27
|
}
|
|
28
28
|
//添加方法属性
|
|
29
|
-
if (typeof config.methods
|
|
29
|
+
if (typeof config.methods === "undefined") {
|
|
30
30
|
this.methods = {};
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
this.methods = config.methods;
|
|
34
34
|
}
|
|
35
35
|
//添加监控属性
|
|
36
|
-
if (typeof config.watcher
|
|
36
|
+
if (typeof config.watcher === "undefined") {
|
|
37
37
|
this.watcher = {};
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
this.watcher = config.watcher;
|
|
41
41
|
}
|
|
42
42
|
//生命周期函数
|
|
43
|
-
if (typeof config.beforeRender
|
|
43
|
+
if (typeof config.beforeRender === "undefined") {
|
|
44
44
|
this.beforeRender = function () { };
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
this.beforeRender = config.beforeRender;
|
|
48
48
|
}
|
|
49
|
-
if (typeof config.afterRender
|
|
49
|
+
if (typeof config.afterRender === "undefined") {
|
|
50
50
|
this.afterRender = function () { };
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
this.afterRender = config.afterRender;
|
|
54
54
|
}
|
|
55
|
-
if (typeof config.beforeUpdate
|
|
55
|
+
if (typeof config.beforeUpdate === "undefined") {
|
|
56
56
|
this.beforeUpdate = function () { };
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
this.beforeUpdate = config.beforeUpdate;
|
|
60
60
|
}
|
|
61
|
-
if (typeof config.afterUpdate
|
|
61
|
+
if (typeof config.afterUpdate === "undefined") {
|
|
62
62
|
this.afterUpdate = function () { };
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
65
|
this.afterUpdate = config.afterUpdate;
|
|
66
66
|
}
|
|
67
|
-
if (typeof config.beforeMount
|
|
67
|
+
if (typeof config.beforeMount === "undefined") {
|
|
68
68
|
this.beforeMount = function () { };
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
71
|
this.beforeMount = config.beforeMount;
|
|
72
72
|
}
|
|
73
|
-
if (typeof config.beforeUnmount
|
|
73
|
+
if (typeof config.beforeUnmount === "undefined") {
|
|
74
74
|
this.beforeUnmount = function () { };
|
|
75
75
|
}
|
|
76
76
|
else {
|
package/class/pageController.js
CHANGED
|
@@ -15,9 +15,11 @@ var PageController = /** @class */ (function () {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(PageController.prototype, "crtTag", {
|
|
18
|
+
//返回当前页面的渲染元素
|
|
18
19
|
get: function () {
|
|
19
20
|
return this.currentTag;
|
|
20
21
|
},
|
|
22
|
+
//设置当前页面的渲染元素
|
|
21
23
|
set: function (element) {
|
|
22
24
|
this.currentTag = element;
|
|
23
25
|
},
|
package/library/render/render.js
CHANGED
|
@@ -54,7 +54,7 @@ export function post_render(proto, parent, child, link, tagTemplate) {
|
|
|
54
54
|
//保持控制器模板对象
|
|
55
55
|
controller.proto = proto;
|
|
56
56
|
//复制原始数据对象到控制对象
|
|
57
|
-
controller.raw_data = proto.getData();
|
|
57
|
+
controller.raw_data = Object.create(proto.getData());
|
|
58
58
|
//向raw_data中注入元数据
|
|
59
59
|
inject(controller, tagTemplate);
|
|
60
60
|
//保持数据代理对象
|
|
@@ -96,7 +96,7 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
|
96
96
|
//向raw_data中注入元数据
|
|
97
97
|
inject(controller, tagTemplate);
|
|
98
98
|
//复制原始数据对象到控制对象
|
|
99
|
-
controller.raw_data = proto.getData();
|
|
99
|
+
controller.raw_data = Object.create(proto.getData());
|
|
100
100
|
//数据渲染对象
|
|
101
101
|
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
102
102
|
injectComputed(controller, proto);
|