@tuya-miniapp/smart-ui 2.10.1-beta-0 → 2.10.1-beta-2

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.
@@ -25,6 +25,12 @@ SmartComponent({
25
25
  type: Boolean,
26
26
  value: true,
27
27
  },
28
+ sidebarFontSize: {
29
+ type: String,
30
+ },
31
+ sidebarLineHeight: {
32
+ type: String,
33
+ },
28
34
  zIndex: {
29
35
  type: Number,
30
36
  value: 1,
@@ -81,7 +87,7 @@ SmartComponent({
81
87
  });
82
88
  },
83
89
  setRect() {
84
- return Promise.all([this.setAnchorsRect(), this.setListRect(), this.setSiderbarRect()]);
90
+ return Promise.all([this.setAnchorsRect(), this.setListRect(), this.setSidebarRect()]);
85
91
  },
86
92
  setAnchorsRect() {
87
93
  return Promise.all(this.children.map(anchor => getRect(anchor, '.smart-index-anchor-wrapper').then(rect => {
@@ -102,7 +108,7 @@ SmartComponent({
102
108
  });
103
109
  });
104
110
  },
105
- setSiderbarRect() {
111
+ setSidebarRect() {
106
112
  return getRect(this, '.smart-index-bar__sidebar').then(res => {
107
113
  if (!isDef(res)) {
108
114
  return;
@@ -13,7 +13,7 @@
13
13
  wx:for="{{ indexList }}"
14
14
  wx:key="index"
15
15
  class="smart-index-bar__index"
16
- style="z-index: {{ zIndex + 1 }}; color: {{ activeAnchorIndex === index ? highlightColor : '' }}"
16
+ style="z-index: {{ zIndex + 1 }};color: {{ activeAnchorIndex === index ? highlightColor : '' }};font-size: {{ sidebarFontSize }};line-height: {{ sidebarLineHeight }};"
17
17
  data-index="{{ index }}"
18
18
  >
19
19
  {{ item }}
@@ -44,6 +44,7 @@ export function transition(showDefaultValue) {
44
44
  display: false,
45
45
  animating: false,
46
46
  status: '',
47
+ isShowed: false,
47
48
  },
48
49
  ready() {
49
50
  if (this.data.show === true) {
@@ -52,6 +53,11 @@ export function transition(showDefaultValue) {
52
53
  },
53
54
  methods: {
54
55
  observeShow(value, old) {
56
+ if (!this.data.isShowed && value) {
57
+ this.setData({
58
+ isShowed: true,
59
+ });
60
+ }
55
61
  if (value === old) {
56
62
  return;
57
63
  }
@@ -3,19 +3,21 @@
3
3
 
4
4
  <import src="./popup.wxml" />
5
5
 
6
- <smart-overlay
7
- wx:if="{{ overlay }}"
8
- show="{{ show }}"
9
- z-index="{{ zIndex }}"
10
- custom-style="{{ overlayStyle }}"
11
- duration="{{ duration }}"
12
- bind:click="onClickOverlay"
13
- lock-scroll="{{ lockScroll }}"
14
- root-portal="{{ rootPortal }}"
15
- />
6
+ <block wx:if="{{ isShowed }}">
7
+ <smart-overlay
8
+ wx:if="{{ overlay }}"
9
+ show="{{ show }}"
10
+ z-index="{{ zIndex }}"
11
+ custom-style="{{ overlayStyle }}"
12
+ duration="{{ duration }}"
13
+ bind:click="onClickOverlay"
14
+ lock-scroll="{{ lockScroll }}"
15
+ root-portal="{{ rootPortal }}"
16
+ />
16
17
 
17
- <root-portal wx:if="{{ rootPortal }}">
18
- <include src="./popup.wxml" />
19
- </root-portal>
18
+ <root-portal wx:if="{{ rootPortal }}">
19
+ <include src="./popup.wxml" />
20
+ </root-portal>
20
21
 
21
- <include wx:else src="./popup.wxml" />
22
+ <include wx:else src="./popup.wxml" />
23
+ </block>
@@ -30,6 +30,12 @@ var indexList = function () {
30
30
  type: Boolean,
31
31
  value: true,
32
32
  },
33
+ sidebarFontSize: {
34
+ type: String,
35
+ },
36
+ sidebarLineHeight: {
37
+ type: String,
38
+ },
33
39
  zIndex: {
34
40
  type: Number,
35
41
  value: 1,
@@ -87,7 +93,7 @@ var indexList = function () {
87
93
  });
88
94
  },
89
95
  setRect: function () {
90
- return Promise.all([this.setAnchorsRect(), this.setListRect(), this.setSiderbarRect()]);
96
+ return Promise.all([this.setAnchorsRect(), this.setListRect(), this.setSidebarRect()]);
91
97
  },
92
98
  setAnchorsRect: function () {
93
99
  var _this = this;
@@ -112,7 +118,7 @@ var indexList = function () {
112
118
  });
113
119
  });
114
120
  },
115
- setSiderbarRect: function () {
121
+ setSidebarRect: function () {
116
122
  var _this = this;
117
123
  return (0, utils_1.getRect)(this, '.smart-index-bar__sidebar').then(function (res) {
118
124
  if (!(0, utils_1.isDef)(res)) {
@@ -13,7 +13,7 @@
13
13
  wx:for="{{ indexList }}"
14
14
  wx:key="index"
15
15
  class="smart-index-bar__index"
16
- style="z-index: {{ zIndex + 1 }}; color: {{ activeAnchorIndex === index ? highlightColor : '' }}"
16
+ style="z-index: {{ zIndex + 1 }};color: {{ activeAnchorIndex === index ? highlightColor : '' }};font-size: {{ sidebarFontSize }};line-height: {{ sidebarLineHeight }};"
17
17
  data-index="{{ index }}"
18
18
  >
19
19
  {{ item }}
@@ -77,6 +77,7 @@ function transition(showDefaultValue) {
77
77
  display: false,
78
78
  animating: false,
79
79
  status: '',
80
+ isShowed: false,
80
81
  },
81
82
  ready: function () {
82
83
  if (this.data.show === true) {
@@ -85,6 +86,11 @@ function transition(showDefaultValue) {
85
86
  },
86
87
  methods: {
87
88
  observeShow: function (value, old) {
89
+ if (!this.data.isShowed && value) {
90
+ this.setData({
91
+ isShowed: true,
92
+ });
93
+ }
88
94
  if (value === old) {
89
95
  return;
90
96
  }
@@ -3,19 +3,21 @@
3
3
 
4
4
  <import src="./popup.wxml" />
5
5
 
6
- <smart-overlay
7
- wx:if="{{ overlay }}"
8
- show="{{ show }}"
9
- z-index="{{ zIndex }}"
10
- custom-style="{{ overlayStyle }}"
11
- duration="{{ duration }}"
12
- bind:click="onClickOverlay"
13
- lock-scroll="{{ lockScroll }}"
14
- root-portal="{{ rootPortal }}"
15
- />
6
+ <block wx:if="{{ isShowed }}">
7
+ <smart-overlay
8
+ wx:if="{{ overlay }}"
9
+ show="{{ show }}"
10
+ z-index="{{ zIndex }}"
11
+ custom-style="{{ overlayStyle }}"
12
+ duration="{{ duration }}"
13
+ bind:click="onClickOverlay"
14
+ lock-scroll="{{ lockScroll }}"
15
+ root-portal="{{ rootPortal }}"
16
+ />
16
17
 
17
- <root-portal wx:if="{{ rootPortal }}">
18
- <include src="./popup.wxml" />
19
- </root-portal>
18
+ <root-portal wx:if="{{ rootPortal }}">
19
+ <include src="./popup.wxml" />
20
+ </root-portal>
20
21
 
21
- <include wx:else src="./popup.wxml" />
22
+ <include wx:else src="./popup.wxml" />
23
+ </block>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.10.1-beta-0",
3
+ "version": "2.10.1-beta-2",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",