@tarojs/plugin-platform-harmony-ets 4.0.0-beta.15 → 4.0.0-beta.16

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.
@@ -43,19 +43,21 @@ export default struct TaroText {
43
43
  @ObjectLink node: TaroTextElement
44
44
 
45
45
  build () {
46
- if (this.node.nodeType === NodeType.TEXT_NODE && this.node.parentNode) {
47
- if ((this.node.parentNode as TaroElement).tagName === 'BUTTON') {
48
- Text(this.node.textContent)
49
- .textNormalFontStyle(getNormalAttributes(this.node.parentNode as TaroElement))
50
- .textSpecialFontStyle(getFontAttributes(this.node.parentNode as TaroElement))
51
- .fontSize((this.node.parentNode as TaroButtonElement).hmStyle.fontSize || getButtonFontSize(this.node.parentNode as TaroButtonElement))
52
- .fontColor((this.node.parentNode as TaroButtonElement).hmStyle.color || getButtonColor(this.node.parentNode as TaroButtonElement, BUTTON_THEME_COLOR.get((this.node.parentNode as TaroButtonElement)._attrs.type).text))
53
- } else {
54
- Text(this.node.textContent)
55
- .textNormalFontStyle(getNormalAttributes(this.node.parentNode as TaroElement))
56
- .textSpecialFontStyle(getFontAttributes(this.node.parentNode as TaroElement))
57
- .width(getNormalAttributes(this.node.parentNode as TaroElement).width)
58
- .height(getNormalAttributes(this.node.parentNode as TaroElement).height)
46
+ if (this.node.nodeType === NodeType.TEXT_NODE) {
47
+ if (this.node.parentNode) {
48
+ if ((this.node.parentNode as TaroElement).tagName === 'BUTTON') {
49
+ Text(this.node.textContent)
50
+ .textNormalFontStyle(getNormalAttributes(this.node.parentNode as TaroElement))
51
+ .textSpecialFontStyle(getFontAttributes(this.node.parentNode as TaroElement))
52
+ .fontSize((this.node.parentNode as TaroButtonElement).hmStyle.fontSize || getButtonFontSize(this.node.parentNode as TaroButtonElement))
53
+ .fontColor((this.node.parentNode as TaroButtonElement).hmStyle.color || getButtonColor(this.node.parentNode as TaroButtonElement, BUTTON_THEME_COLOR.get((this.node.parentNode as TaroButtonElement)._attrs.type).text))
54
+ } else {
55
+ Text(this.node.textContent)
56
+ .textNormalFontStyle(getNormalAttributes(this.node.parentNode as TaroElement))
57
+ .textSpecialFontStyle(getFontAttributes(this.node.parentNode as TaroElement))
58
+ .width(getNormalAttributes(this.node.parentNode as TaroElement).width)
59
+ .height(getNormalAttributes(this.node.parentNode as TaroElement).height)
60
+ }
59
61
  }
60
62
  } else {
61
63
  Text(this.node.textContent)
@@ -11,6 +11,8 @@ export function getFontAttributes (node: TaroElement): TaroTextStyleType {
11
11
  const hmStyle = node.hmStyle
12
12
  const attrs: TextProps = node._attrs || {}
13
13
 
14
+ if (!hmStyle) return {}
15
+
14
16
  const attributes: TaroAny = {
15
17
  WebkitLineClamp: attrs.maxLines || hmStyle.WebkitLineClamp || Infinity,
16
18
  // 已做处理的属性
@@ -32,6 +34,8 @@ function isMaxWidthView (node: TaroElement) {
32
34
 
33
35
  export function getNormalAttributes (node: TaroElement): TaroStyleType {
34
36
  const hmStyle = node.hmStyle
37
+
38
+ if (!hmStyle) return {}
35
39
 
36
40
  const _nid = node._nid
37
41
  const _attrs: StandardProps = node._attrs || {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/plugin-platform-harmony-ets",
3
- "version": "4.0.0-beta.15",
3
+ "version": "4.0.0-beta.16",
4
4
  "description": "OpenHarmony & 鸿蒙系统插件",
5
5
  "author": "O2Team",
6
6
  "homepage": "https://gitee.com/openharmony-sig/taro",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "webpack-sources": "^3.2.3",
28
- "@tarojs/components": "4.0.0-beta.15",
29
- "@tarojs/helper": "4.0.0-beta.15",
30
- "@tarojs/runner-utils": "4.0.0-beta.15",
31
- "@tarojs/runtime": "4.0.0-beta.15",
32
- "@tarojs/service": "4.0.0-beta.15",
33
- "@tarojs/shared": "4.0.0-beta.15",
34
- "@tarojs/taro": "4.0.0-beta.15"
28
+ "@tarojs/components": "4.0.0-beta.16",
29
+ "@tarojs/helper": "4.0.0-beta.16",
30
+ "@tarojs/runner-utils": "4.0.0-beta.16",
31
+ "@tarojs/runtime": "4.0.0-beta.16",
32
+ "@tarojs/service": "4.0.0-beta.16",
33
+ "@tarojs/shared": "4.0.0-beta.16",
34
+ "@tarojs/taro": "4.0.0-beta.16"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-commonjs": "^25.0.7",