@dcloudio/uni-mp-toutiao 3.0.0-alpha-3021320211117003 → 3.0.0-alpha-3021320211118002
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/dist/uni.api.esm.js +4 -4
- package/dist/uni.mp.esm.js +17 -14
- package/package.json +6 -6
- package/src/runtime/componentLifetimes.ts +8 -16
package/dist/uni.api.esm.js
CHANGED
|
@@ -272,7 +272,7 @@ function getApiInterceptorHooks(method) {
|
|
|
272
272
|
}
|
|
273
273
|
return interceptor;
|
|
274
274
|
}
|
|
275
|
-
function invokeApi(method, api, options,
|
|
275
|
+
function invokeApi(method, api, options, params) {
|
|
276
276
|
const interceptor = getApiInterceptorHooks(method);
|
|
277
277
|
if (interceptor && Object.keys(interceptor).length) {
|
|
278
278
|
if (isArray(interceptor.invoke)) {
|
|
@@ -622,17 +622,17 @@ function promisify(name, api) {
|
|
|
622
622
|
if (!isFunction(api)) {
|
|
623
623
|
return api;
|
|
624
624
|
}
|
|
625
|
-
return function promiseApi(options = {}) {
|
|
625
|
+
return function promiseApi(options = {}, ...rest) {
|
|
626
626
|
if (isFunction(options.success) ||
|
|
627
627
|
isFunction(options.fail) ||
|
|
628
628
|
isFunction(options.complete)) {
|
|
629
|
-
return wrapperReturnValue(name, invokeApi(name, api, options));
|
|
629
|
+
return wrapperReturnValue(name, invokeApi(name, api, options, rest));
|
|
630
630
|
}
|
|
631
631
|
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
|
|
632
632
|
invokeApi(name, api, extend({}, options, {
|
|
633
633
|
success: resolve,
|
|
634
634
|
fail: reject,
|
|
635
|
-
}));
|
|
635
|
+
}), rest);
|
|
636
636
|
})));
|
|
637
637
|
};
|
|
638
638
|
}
|
package/dist/uni.mp.esm.js
CHANGED
|
@@ -513,6 +513,16 @@ function findVmByVueId(instance, vuePid) {
|
|
|
513
513
|
return parentVm;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* @param properties
|
|
519
|
+
*/
|
|
520
|
+
function fixProperties(properties) {
|
|
521
|
+
Object.keys(properties).forEach((name) => {
|
|
522
|
+
if (properties[name] === null) {
|
|
523
|
+
properties[name] = undefined;
|
|
524
|
+
}
|
|
525
|
+
});
|
|
516
526
|
}
|
|
517
527
|
|
|
518
528
|
const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
|
|
@@ -917,6 +927,13 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
|
|
|
917
927
|
if (mpType === 'page' && !mpInstance.route && mpInstance.__route__) {
|
|
918
928
|
mpInstance.route = mpInstance.__route__;
|
|
919
929
|
}
|
|
930
|
+
// 字节跳动小程序 properties
|
|
931
|
+
// 父组件在 attached 中 setData 设置了子组件的 props,在子组件的 attached 中,并不能立刻拿到
|
|
932
|
+
// 此时子组件的 properties 中获取到的值,除了一部分初始化就有的值,只要在模板上绑定了,动态设置的 prop 的值均会根据类型返回,不会应用 prop 自己的默认值
|
|
933
|
+
// 举例: easyinput 的 styles 属性,类型为 Object,`<easyinput :styles="styles"/>` 在 attached 中 styles 的值为 null
|
|
934
|
+
// 目前 null 值会影响 render 函数执行,临时解决方案,调整 properties 中的 null 值为 undefined,让 Vue 来补充为默认值
|
|
935
|
+
// 已知的其他隐患,当使用默认值时,可能组件行为不正确,比如 countdown 组件,默认值是0,导致直接就触发了 timeup 事件,这个应该是组件自身做处理?
|
|
936
|
+
// 难道要等父组件首次 setData 完成后,再去执行子组件的初始化?
|
|
920
937
|
fixProperties(properties);
|
|
921
938
|
this.$vm = $createComponent({
|
|
922
939
|
type: vueOptions,
|
|
@@ -957,20 +974,6 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
|
|
|
957
974
|
},
|
|
958
975
|
detached,
|
|
959
976
|
};
|
|
960
|
-
}
|
|
961
|
-
function fixProperties(properties) {
|
|
962
|
-
// 字节跳动小程序 properties
|
|
963
|
-
// 父组件在 attached 中 setData 设置了子组件的 props,在子组件的 attached 中,并不能立刻拿到
|
|
964
|
-
// 此时子组件的 properties 中获取到的值,除了一部分初始化就有的值,只要在模板上绑定了,动态设置的 prop 的值均会根据类型返回,不会应用 prop 自己的默认值
|
|
965
|
-
// 举例: easyinput 的 styles 属性,类型为 Object,`<easyinput :styles="styles"/>` 在 attached 中 styles 的值为 null
|
|
966
|
-
// 目前 null 值会影响 render 函数执行,临时解决方案,调整 properties 中的 null 值为 undefined,让 Vue 来补充为默认值
|
|
967
|
-
// 已知的其他隐患,当使用默认值时,可能组件行为不正确,比如 countdown 组件,默认值是0,导致直接就触发了 timeup 事件,这个应该是组件自身做处理?
|
|
968
|
-
// 难道要等父组件首次 setData 完成后,再去执行子组件的初始化?
|
|
969
|
-
Object.keys(properties).forEach((name) => {
|
|
970
|
-
if (properties[name] === null) {
|
|
971
|
-
properties[name] = undefined;
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
977
|
}
|
|
975
978
|
|
|
976
979
|
const mocks = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-mp-toutiao",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3021320211118002",
|
|
4
4
|
"description": "uni-app mp-toutiao",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dcloudio/uni-cli-shared": "3.0.0-alpha-
|
|
26
|
-
"@dcloudio/uni-mp-compiler": "3.0.0-alpha-
|
|
27
|
-
"@dcloudio/uni-mp-vite": "3.0.0-alpha-
|
|
28
|
-
"@dcloudio/uni-mp-vue": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
25
|
+
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3021320211118002",
|
|
26
|
+
"@dcloudio/uni-mp-compiler": "3.0.0-alpha-3021320211118002",
|
|
27
|
+
"@dcloudio/uni-mp-vite": "3.0.0-alpha-3021320211118002",
|
|
28
|
+
"@dcloudio/uni-mp-vue": "3.0.0-alpha-3021320211118002",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3021320211118002",
|
|
30
30
|
"@vue/compiler-core": "3.2.22"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
MPComponentInstance,
|
|
6
6
|
CreateComponentOptions,
|
|
7
7
|
CreateLifetimesOptions,
|
|
8
|
+
fixProperties,
|
|
8
9
|
} from '@dcloudio/uni-mp-core'
|
|
9
10
|
|
|
10
11
|
import {
|
|
@@ -42,7 +43,13 @@ export function initLifetimes({
|
|
|
42
43
|
if (mpType === 'page' && !mpInstance.route && mpInstance.__route__) {
|
|
43
44
|
mpInstance.route = mpInstance.__route__
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
// 字节跳动小程序 properties
|
|
47
|
+
// 父组件在 attached 中 setData 设置了子组件的 props,在子组件的 attached 中,并不能立刻拿到
|
|
48
|
+
// 此时子组件的 properties 中获取到的值,除了一部分初始化就有的值,只要在模板上绑定了,动态设置的 prop 的值均会根据类型返回,不会应用 prop 自己的默认值
|
|
49
|
+
// 举例: easyinput 的 styles 属性,类型为 Object,`<easyinput :styles="styles"/>` 在 attached 中 styles 的值为 null
|
|
50
|
+
// 目前 null 值会影响 render 函数执行,临时解决方案,调整 properties 中的 null 值为 undefined,让 Vue 来补充为默认值
|
|
51
|
+
// 已知的其他隐患,当使用默认值时,可能组件行为不正确,比如 countdown 组件,默认值是0,导致直接就触发了 timeup 事件,这个应该是组件自身做处理?
|
|
52
|
+
// 难道要等父组件首次 setData 完成后,再去执行子组件的初始化?
|
|
46
53
|
fixProperties(properties)
|
|
47
54
|
|
|
48
55
|
this.$vm = $createComponent(
|
|
@@ -98,18 +105,3 @@ export function initLifetimes({
|
|
|
98
105
|
detached,
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
|
-
|
|
102
|
-
function fixProperties(properties: Record<string, any>) {
|
|
103
|
-
// 字节跳动小程序 properties
|
|
104
|
-
// 父组件在 attached 中 setData 设置了子组件的 props,在子组件的 attached 中,并不能立刻拿到
|
|
105
|
-
// 此时子组件的 properties 中获取到的值,除了一部分初始化就有的值,只要在模板上绑定了,动态设置的 prop 的值均会根据类型返回,不会应用 prop 自己的默认值
|
|
106
|
-
// 举例: easyinput 的 styles 属性,类型为 Object,`<easyinput :styles="styles"/>` 在 attached 中 styles 的值为 null
|
|
107
|
-
// 目前 null 值会影响 render 函数执行,临时解决方案,调整 properties 中的 null 值为 undefined,让 Vue 来补充为默认值
|
|
108
|
-
// 已知的其他隐患,当使用默认值时,可能组件行为不正确,比如 countdown 组件,默认值是0,导致直接就触发了 timeup 事件,这个应该是组件自身做处理?
|
|
109
|
-
// 难道要等父组件首次 setData 完成后,再去执行子组件的初始化?
|
|
110
|
-
Object.keys(properties).forEach((name) => {
|
|
111
|
-
if (properties[name] === null) {
|
|
112
|
-
properties[name] = undefined
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
}
|