@dcloudio/uni-mp-toutiao 3.0.0-alpha-3021320211115001 → 3.0.0-alpha-3021320211117004

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.
@@ -1,3 +1,4 @@
1
+ import { isMiniProgramNativeTag as isNativeTag } from '@dcloudio/uni-shared'
1
2
  import { compile, CompilerOptions } from '@dcloudio/uni-mp-compiler'
2
3
 
3
4
  import { miniProgram, compilerOptions } from '../src/compiler/options'
@@ -16,6 +17,7 @@ export function assert(
16
17
  generatorOpts: {
17
18
  concise: true,
18
19
  },
20
+ isNativeTag,
19
21
  miniProgram: {
20
22
  ...miniProgram,
21
23
  emitFile({ source }) {
@@ -2,7 +2,6 @@
2
2
 
3
3
  var initMiniProgramPlugin = require('@dcloudio/uni-mp-vite');
4
4
  var path = require('path');
5
- var uniShared = require('@dcloudio/uni-shared');
6
5
  var uniCliShared = require('@dcloudio/uni-cli-shared');
7
6
  var uniMpCompiler = require('@dcloudio/uni-mp-compiler');
8
7
  var compilerCore = require('@vue/compiler-core');
@@ -71,8 +70,6 @@ const nodeTransforms = [
71
70
  uniCliShared.transformComponentLink,
72
71
  ];
73
72
  const compilerOptions = {
74
- isNativeTag: uniShared.isNativeTag,
75
- isCustomElement: uniShared.isCustomElement,
76
73
  nodeTransforms,
77
74
  };
78
75
  const miniProgram = {
@@ -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-3021320211115001",
3
+ "version": "3.0.0-alpha-3021320211117004",
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-3021320211115001",
26
- "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3021320211115001",
27
- "@dcloudio/uni-mp-vite": "3.0.0-alpha-3021320211115001",
28
- "@dcloudio/uni-mp-vue": "3.0.0-alpha-3021320211115001",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3021320211115001",
25
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3021320211117004",
26
+ "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3021320211117004",
27
+ "@dcloudio/uni-mp-vite": "3.0.0-alpha-3021320211117004",
28
+ "@dcloudio/uni-mp-vue": "3.0.0-alpha-3021320211117004",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3021320211117004",
30
30
  "@vue/compiler-core": "3.2.22"
31
31
  }
32
32
  }
@@ -1,6 +1,5 @@
1
1
  import path from 'path'
2
2
  import type { CompilerOptions } from '@vue/compiler-core'
3
- import { isCustomElement, isNativeTag } from '@dcloudio/uni-shared'
4
3
  import {
5
4
  MiniProgramCompilerOptions,
6
5
  transformComponentLink,
@@ -22,8 +21,6 @@ const nodeTransforms = [
22
21
  ]
23
22
 
24
23
  export const compilerOptions: CompilerOptions = {
25
- isNativeTag,
26
- isCustomElement,
27
24
  nodeTransforms,
28
25
  }
29
26
  export const miniProgram: MiniProgramCompilerOptions = {
@@ -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
- }