@tarojs/plugin-platform-harmony-ets 4.0.0-beta.52 → 4.0.0-beta.53
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/apis/ui/scroll/index.ts +1 -1
- package/dist/components-harmony-ets/navigationBar.ets +5 -4
- package/dist/components-harmony-ets/pageMeta.ets +28 -17
- package/dist/runtime-utils.js +1 -1
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -34,7 +34,7 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
|
|
|
34
34
|
const page = taro.getCurrentInstance().page
|
|
35
35
|
|
|
36
36
|
let scrollValue = -1
|
|
37
|
-
let scroller = page.scroller
|
|
37
|
+
let scroller = getPageScrollerOrNode(page.scroller, page)
|
|
38
38
|
const currentPageNode = getPageScrollerOrNode(page.node, page)
|
|
39
39
|
|
|
40
40
|
if (scrollTop || typeof scrollTop === 'number') {
|
|
@@ -19,15 +19,16 @@ export default struct TaroNavigationBar {
|
|
|
19
19
|
this.node._instance = this
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
// FIXME 在 Harmony 提供 @Watch 文档后,根据 node 实际使用更细粒度的监听
|
|
23
|
+
eventCenter.on('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
23
24
|
this.handleAttributes(this.node._attrs)
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
aboutToDisappear(): void {
|
|
27
|
-
eventCenter.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate
|
|
28
|
+
eventCenter.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
handleAttributeUpdate (opt: IComponentAttributeUpdateEvents) {
|
|
31
|
+
handleAttributeUpdate = (opt: IComponentAttributeUpdateEvents) => {
|
|
31
32
|
if (opt.id === this.node._nid && opt.tagName === 'NAVIGATION-BAR') {
|
|
32
33
|
const attrs: Record<string, TaroAny> = {}
|
|
33
34
|
attrs[opt.attribute] = opt.value
|
|
@@ -38,7 +39,6 @@ export default struct TaroNavigationBar {
|
|
|
38
39
|
handleAttributes (attrs: Record<string, TaroAny>) {
|
|
39
40
|
const options: Record<string, TaroAny> = {}
|
|
40
41
|
|
|
41
|
-
// FIXME 更新类型支持度
|
|
42
42
|
if (attrs.title) {
|
|
43
43
|
options.title = attrs.title
|
|
44
44
|
}
|
|
@@ -52,6 +52,7 @@ export default struct TaroNavigationBar {
|
|
|
52
52
|
options.frontColor = attrs.frontColor
|
|
53
53
|
}
|
|
54
54
|
eventCenter.trigger('__taroNavigationStyle', options)
|
|
55
|
+
// FIXME: 以下属性暂时不支持
|
|
55
56
|
// attrs.colorAnimationDuration
|
|
56
57
|
// attrs.colorAnimationTimingFunc
|
|
57
58
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APP, eventCenter } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
+
import { getCurrentInstance, pageScrollTo } from '@tarojs/taro'
|
|
2
3
|
|
|
3
4
|
import { isTagFirstChild } from './utils/helper'
|
|
4
5
|
|
|
@@ -17,24 +18,29 @@ export default struct TaroPageMeta {
|
|
|
17
18
|
@BuilderParam createLazyChildren: (node: TaroPageMetaElement) => void = this.customBuilder
|
|
18
19
|
@ObjectLink node: TaroPageMetaElement
|
|
19
20
|
|
|
21
|
+
page: TaroAny = {}
|
|
22
|
+
|
|
20
23
|
aboutToAppear(): void {
|
|
21
24
|
if (!isTagFirstChild(this.node, APP, 2)) {
|
|
22
25
|
// PageMeta 只能是页面内的第一个元素
|
|
23
26
|
console.error('PageMeta 只能是页面内的第一个元素。')
|
|
24
27
|
}
|
|
28
|
+
|
|
29
|
+
this.page = getCurrentInstance().page
|
|
25
30
|
if (this.node) {
|
|
26
31
|
this.node._instance = this
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
// FIXME 在 Harmony 提供 @Watch 文档后,根据 node 实际使用更细粒度的监听
|
|
35
|
+
eventCenter.on('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
30
36
|
this.handleAttributes(this.node._attrs)
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
aboutToDisappear(): void {
|
|
34
|
-
eventCenter.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate
|
|
40
|
+
eventCenter.off('__taroComponentAttributeUpdate', this.handleAttributeUpdate)
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
handleAttributeUpdate (opt: IComponentAttributeUpdateEvents) {
|
|
43
|
+
handleAttributeUpdate = (opt: IComponentAttributeUpdateEvents) => {
|
|
38
44
|
if (opt.id === this.node._nid && opt.tagName === 'PAGE-META') {
|
|
39
45
|
const attrs: Record<string, TaroAny> = {}
|
|
40
46
|
attrs[opt.attribute] = opt.value
|
|
@@ -44,32 +50,37 @@ export default struct TaroPageMeta {
|
|
|
44
50
|
|
|
45
51
|
handleAttributes (attrs: Record<string, TaroAny>) {
|
|
46
52
|
const options: Record<string, TaroAny> = {}
|
|
53
|
+
let triggerStyleEvent = false
|
|
47
54
|
|
|
48
55
|
// FIXME 更新类型支持度
|
|
49
|
-
if (attrs.backgroundColorTop ||
|
|
50
|
-
options.backgroundColorContext = attrs.backgroundColorTop ||
|
|
56
|
+
if (attrs.backgroundColorTop || attrs.rootBackgroundColor || attrs.backgroundColor) {
|
|
57
|
+
options.backgroundColorContext = attrs.backgroundColorTop || attrs.rootBackgroundColor || attrs.backgroundColor
|
|
58
|
+
triggerStyleEvent = true
|
|
51
59
|
}
|
|
52
|
-
if (attrs.backgroundColorBottom ||
|
|
53
|
-
options.backgroundColor = attrs.backgroundColorBottom ||
|
|
60
|
+
if (attrs.backgroundColorBottom || attrs.backgroundColor) {
|
|
61
|
+
options.backgroundColor = attrs.backgroundColorBottom || attrs.backgroundColor
|
|
62
|
+
triggerStyleEvent = true
|
|
54
63
|
}
|
|
55
64
|
if (attrs.backgroundTextStyle) {
|
|
56
65
|
options.backgroundTextStyle = attrs.backgroundTextStyle
|
|
66
|
+
triggerStyleEvent = true
|
|
57
67
|
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (attrs.rootBackgroundColor) {
|
|
67
|
-
options.backgroundColor = attrs.rootBackgroundColor
|
|
69
|
+
if (this.page === getCurrentInstance().page) {
|
|
70
|
+
if (attrs.scrollTop || attrs.scrollDuration) {
|
|
71
|
+
pageScrollTo({
|
|
72
|
+
scrollTop: attrs.scrollTop || this.node._attrs.scrollTop,
|
|
73
|
+
duration: attrs.scrollDuration || this.node._attrs.scrollDuration,
|
|
74
|
+
} as TaroAny)
|
|
75
|
+
}
|
|
68
76
|
}
|
|
77
|
+
// pageStyle
|
|
69
78
|
// rootFontSize
|
|
70
79
|
// pageFontSize
|
|
71
80
|
// pageOrientation
|
|
72
|
-
|
|
81
|
+
if (triggerStyleEvent) {
|
|
82
|
+
eventCenter.trigger('__taroPageStyle', options)
|
|
83
|
+
}
|
|
73
84
|
// onResize
|
|
74
85
|
// onScroll
|
|
75
86
|
// onScrollDone
|
package/dist/runtime-utils.js
CHANGED
|
@@ -3858,7 +3858,7 @@ const pageScrollTo = (options) => {
|
|
|
3858
3858
|
const taro = Current.taro;
|
|
3859
3859
|
const page = taro.getCurrentInstance().page;
|
|
3860
3860
|
let scrollValue = -1;
|
|
3861
|
-
let scroller = page.scroller;
|
|
3861
|
+
let scroller = getPageScrollerOrNode(page.scroller, page);
|
|
3862
3862
|
const currentPageNode = getPageScrollerOrNode(page.node, page);
|
|
3863
3863
|
if (scrollTop || typeof scrollTop === 'number') {
|
|
3864
3864
|
scrollValue = scrollTop;
|