@tarojs/plugin-platform-harmony-cpp 4.1.0 → 4.1.1-alpha.0
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/index.js +1237 -0
- package/dist/runtime/apis/apis.ts +20 -0
- package/dist/runtime/apis/base/crypto.ts +4 -0
- package/dist/runtime/apis/base/debug.ts +5 -0
- package/dist/runtime/apis/base/index.ts +13 -0
- package/dist/runtime/apis/base/performance.ts +8 -0
- package/dist/runtime/apis/base/system.ts +181 -0
- package/dist/runtime/apis/base/update.ts +5 -0
- package/dist/runtime/apis/base/weapp/app-event.ts +75 -0
- package/dist/runtime/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/runtime/apis/canvas/index.ts +27 -0
- package/dist/runtime/apis/data-analysis/index.ts +6 -0
- package/dist/runtime/apis/device/accelerometer.ts +79 -0
- package/dist/runtime/apis/device/accessibility.ts +4 -0
- package/dist/runtime/apis/device/battery.ts +24 -0
- package/dist/runtime/apis/device/bluetooth-ble.ts +19 -0
- package/dist/runtime/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/runtime/apis/device/bluetooth.ts +16 -0
- package/dist/runtime/apis/device/calendar.ts +5 -0
- package/dist/runtime/apis/device/clipboard.ts +85 -0
- package/dist/runtime/apis/device/compass.ts +21 -0
- package/dist/runtime/apis/device/contact.ts +5 -0
- package/dist/runtime/apis/device/crypto.ts +4 -0
- package/dist/runtime/apis/device/gyroscope.ts +77 -0
- package/dist/runtime/apis/device/iBeacon.ts +10 -0
- package/dist/runtime/apis/device/index.ts +24 -0
- package/dist/runtime/apis/device/keyboard.ts +63 -0
- package/dist/runtime/apis/device/memory.ts +11 -0
- package/dist/runtime/apis/device/motion.ts +6 -0
- package/dist/runtime/apis/device/network.ts +123 -0
- package/dist/runtime/apis/device/nfc.ts +10 -0
- package/dist/runtime/apis/device/phone.ts +44 -0
- package/dist/runtime/apis/device/scan.ts +4 -0
- package/dist/runtime/apis/device/screen.ts +80 -0
- package/dist/runtime/apis/device/sms.ts +4 -0
- package/dist/runtime/apis/device/vibrate.ts +32 -0
- package/dist/runtime/apis/device/wifi.ts +15 -0
- package/dist/runtime/apis/ext/index.ts +5 -0
- package/dist/runtime/apis/files/index.ts +136 -0
- package/dist/runtime/apis/files/manager.ts +942 -0
- package/dist/runtime/apis/framework/index.ts +48 -0
- package/dist/runtime/apis/harmony/task-pool.ts +39 -0
- package/dist/runtime/apis/index.ts +61 -0
- package/dist/runtime/apis/location/index.ts +133 -0
- package/dist/runtime/apis/media/EditorContext.ts +32 -0
- package/dist/runtime/apis/media/audio/index.ts +36 -0
- package/dist/runtime/apis/media/background-audio/index.ts +16 -0
- package/dist/runtime/apis/media/camera.ts +16 -0
- package/dist/runtime/apis/media/common.ts +58 -0
- package/dist/runtime/apis/media/image/index.ts +291 -0
- package/dist/runtime/apis/media/index.ts +13 -0
- package/dist/runtime/apis/media/live.ts +5 -0
- package/dist/runtime/apis/media/map.ts +4 -0
- package/dist/runtime/apis/media/media-recorder.ts +4 -0
- package/dist/runtime/apis/media/recorder.ts +6 -0
- package/dist/runtime/apis/media/video/VideoContext.ts +67 -0
- package/dist/runtime/apis/media/video/index.ts +45 -0
- package/dist/runtime/apis/media/video-decoder.ts +4 -0
- package/dist/runtime/apis/media/video-processing.ts +4 -0
- package/dist/runtime/apis/media/voip.ts +19 -0
- package/dist/runtime/apis/navigate/index.ts +8 -0
- package/dist/runtime/apis/network/downloadFile.ts +85 -0
- package/dist/runtime/apis/network/index.ts +7 -0
- package/dist/runtime/apis/network/mdns.ts +13 -0
- package/dist/runtime/apis/network/request.ts +140 -0
- package/dist/runtime/apis/network/tcp.ts +4 -0
- package/dist/runtime/apis/network/udp.ts +4 -0
- package/dist/runtime/apis/network/uploadFile.ts +105 -0
- package/dist/runtime/apis/network/webSocket.ts +126 -0
- package/dist/runtime/apis/open-api/account.ts +4 -0
- package/dist/runtime/apis/open-api/address.ts +4 -0
- package/dist/runtime/apis/open-api/authorize.ts +5 -0
- package/dist/runtime/apis/open-api/card.ts +5 -0
- package/dist/runtime/apis/open-api/channels-live.ts +11 -0
- package/dist/runtime/apis/open-api/customer-service.ts +4 -0
- package/dist/runtime/apis/open-api/device-voip.ts +5 -0
- package/dist/runtime/apis/open-api/facial.ts +7 -0
- package/dist/runtime/apis/open-api/favorites.ts +5 -0
- package/dist/runtime/apis/open-api/group.ts +4 -0
- package/dist/runtime/apis/open-api/index.ts +21 -0
- package/dist/runtime/apis/open-api/invoice.ts +5 -0
- package/dist/runtime/apis/open-api/license-plate.ts +4 -0
- package/dist/runtime/apis/open-api/login.ts +6 -0
- package/dist/runtime/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/runtime/apis/open-api/privacy.ts +7 -0
- package/dist/runtime/apis/open-api/red-package.ts +4 -0
- package/dist/runtime/apis/open-api/settings.ts +5 -0
- package/dist/runtime/apis/open-api/soter.ts +6 -0
- package/dist/runtime/apis/open-api/subscribe-message.ts +6 -0
- package/dist/runtime/apis/open-api/user-info.ts +70 -0
- package/dist/runtime/apis/open-api/werun.ts +5 -0
- package/dist/runtime/apis/payment/index.ts +6 -0
- package/dist/runtime/apis/route/index.ts +88 -0
- package/dist/runtime/apis/share/index.ts +33 -0
- package/dist/runtime/apis/storage/background-fetch.ts +7 -0
- package/dist/runtime/apis/storage/cache-manager.ts +4 -0
- package/dist/runtime/apis/storage/index.ts +203 -0
- package/dist/runtime/apis/ui/animation/animation.ts +264 -0
- package/dist/runtime/apis/ui/animation/index.ts +7 -0
- package/dist/runtime/apis/ui/background.ts +20 -0
- package/dist/runtime/apis/ui/custom-component.ts +1 -0
- package/dist/runtime/apis/ui/fonts.ts +4 -0
- package/dist/runtime/apis/ui/index.ts +12 -0
- package/dist/runtime/apis/ui/interaction/index.ts +198 -0
- package/dist/runtime/apis/ui/menu.ts +4 -0
- package/dist/runtime/apis/ui/navigation-bar/index.ts +72 -0
- package/dist/runtime/apis/ui/pull-down-refresh.ts +47 -0
- package/dist/runtime/apis/ui/scroll/index.ts +82 -0
- package/dist/runtime/apis/ui/sticky.ts +4 -0
- package/dist/runtime/apis/ui/tab-bar.ts +144 -0
- package/dist/runtime/apis/ui/window.ts +20 -0
- package/dist/runtime/apis/utils/constant.ts +1 -0
- package/dist/runtime/apis/utils/handler.ts +117 -0
- package/dist/runtime/apis/utils/index.ts +105 -0
- package/dist/runtime/apis/utils/permissions.ts +6 -0
- package/dist/runtime/apis/utils/types.ts +12 -0
- package/dist/runtime/apis/utils/unit.ts +104 -0
- package/dist/runtime/apis/utils/validate.ts +87 -0
- package/dist/runtime/apis/worker/index.ts +4 -0
- package/dist/runtime/apis/wxml/index.ts +17 -0
- package/dist/runtime/apis/wxml/intersectionObserver.ts +100 -0
- package/dist/runtime/apis/wxml/nodesRef.ts +58 -0
- package/dist/runtime/apis/wxml/selectorQuery.ts +221 -0
- package/dist/runtime/apischunk/index.d.ts +802 -0
- package/dist/runtime/apischunk/index.js +5054 -0
- package/dist/runtime/components/deprecated.ets +43 -0
- package/dist/runtime/components/index.ets +49 -0
- package/dist/runtime/components/innerHtml.ets +16 -0
- package/dist/runtime/components/navigationBar.ets +65 -0
- package/dist/runtime/components/pageMeta.ets +94 -0
- package/dist/runtime/components/richText.ets +24 -0
- package/dist/runtime/components/slider.ets +119 -0
- package/dist/runtime/components/style.ets +286 -0
- package/dist/runtime/components/switch.ets +73 -0
- package/dist/runtime/components/tag.ts +58 -0
- package/dist/runtime/components/utils/AttributeManager.ets +252 -0
- package/dist/runtime/components/utils/DynamicCenter.ts +41 -0
- package/dist/runtime/components/utils/constant/event.ets +25 -0
- package/dist/runtime/components/utils/constant/style.ets +91 -0
- package/dist/runtime/components/utils/events.ts +26 -0
- package/dist/runtime/components/utils/flexManager.ets +49 -0
- package/dist/runtime/components/utils/helper.ets +51 -0
- package/dist/runtime/components/utils/htmlParser/HarmonyHTMLParser.ts +100 -0
- package/dist/runtime/components/utils/htmlParser/index.ts +58 -0
- package/dist/runtime/components/utils/index.ts +77 -0
- package/dist/runtime/components/utils/styles.ets +41 -0
- package/dist/runtime/components/video.ets +119 -0
- package/dist/runtime/components/webView.ets +55 -0
- package/dist/runtime/components/xComponent.ets +89 -0
- package/dist/runtime/framework/app.ts +248 -0
- package/dist/runtime/framework/connect.ts +24 -0
- package/dist/runtime/framework/constant.ts +3 -0
- package/dist/runtime/framework/hooks.ts +99 -0
- package/dist/runtime/framework/index.ts +15 -0
- package/dist/runtime/framework/native-page.ts +511 -0
- package/dist/runtime/framework/page.ts +256 -0
- package/dist/runtime/framework/utils/index.ts +17 -0
- package/dist/runtime/framework/utils/is.ts +26 -0
- package/dist/runtime/framework-reconciler/componentTree.ts +81 -0
- package/dist/runtime/framework-reconciler/constant.ts +86 -0
- package/dist/runtime/framework-reconciler/domInput.ts +90 -0
- package/dist/runtime/framework-reconciler/event.ts +108 -0
- package/dist/runtime/framework-reconciler/index.ts +99 -0
- package/dist/runtime/framework-reconciler/inputValueTracking.ts +106 -0
- package/dist/runtime/framework-reconciler/props.ts +132 -0
- package/dist/runtime/framework-reconciler/reconciler.ts +202 -0
- package/dist/runtime/framework-reconciler/render.ts +139 -0
- package/dist/runtime/framework-reconciler/workTags.ts +53 -0
- package/dist/runtime/runtime-cpp/bom/URL.ts +2 -0
- package/dist/runtime/runtime-cpp/bom/document.ts +45 -0
- package/dist/runtime/runtime-cpp/bom/history.ts +1 -0
- package/dist/runtime/runtime-cpp/bom/location.ts +1 -0
- package/dist/runtime/runtime-cpp/bom/navigator.ts +1 -0
- package/dist/runtime/runtime-cpp/bom/raf.ts +1 -0
- package/dist/runtime/runtime-cpp/bom/window.ts +57 -0
- package/dist/runtime/runtime-cpp/constant.ts +29 -0
- package/dist/runtime/runtime-cpp/current.ts +48 -0
- package/dist/runtime/runtime-cpp/dom/class-list.ts +41 -0
- package/dist/runtime/runtime-cpp/dom/comment.ts +9 -0
- package/dist/runtime/runtime-cpp/dom/dataSource.ts +87 -0
- package/dist/runtime/runtime-cpp/dom/document.ts +113 -0
- package/dist/runtime/runtime-cpp/dom/element/canvas.ts +285 -0
- package/dist/runtime/runtime-cpp/dom/element/element.ts +262 -0
- package/dist/runtime/runtime-cpp/dom/element/form.ts +371 -0
- package/dist/runtime/runtime-cpp/dom/element/index.ts +129 -0
- package/dist/runtime/runtime-cpp/dom/element/movable.ts +250 -0
- package/dist/runtime/runtime-cpp/dom/element/normal.ts +123 -0
- package/dist/runtime/runtime-cpp/dom/element/scroll_view.ts +32 -0
- package/dist/runtime/runtime-cpp/dom/element/text.ts +9 -0
- package/dist/runtime/runtime-cpp/dom/element/video.ts +66 -0
- package/dist/runtime/runtime-cpp/dom/element/web_view.ts +72 -0
- package/dist/runtime/runtime-cpp/dom/event-source.ts +1 -0
- package/dist/runtime/runtime-cpp/dom/event.ts +187 -0
- package/dist/runtime/runtime-cpp/dom/eventTarget.ts +81 -0
- package/dist/runtime/runtime-cpp/dom/node.ts +307 -0
- package/dist/runtime/runtime-cpp/dom/style.ts +44 -0
- package/dist/runtime/runtime-cpp/dom/stylesheet/index.ts +379 -0
- package/dist/runtime/runtime-cpp/dom/stylesheet/type.ts +212 -0
- package/dist/runtime/runtime-cpp/dom/stylesheet/util.ts +186 -0
- package/dist/runtime/runtime-cpp/emitter/emitter.ts +29 -0
- package/dist/runtime/runtime-cpp/env.ts +1 -0
- package/dist/runtime/runtime-cpp/harmony-library.ts +1 -0
- package/dist/runtime/runtime-cpp/index.ts +79 -0
- package/dist/runtime/runtime-cpp/interface/event.ts +10 -0
- package/dist/runtime/runtime-cpp/interface/index.ts +7 -0
- package/dist/runtime/runtime-cpp/next-tick.ts +14 -0
- package/dist/runtime/runtime-cpp/system.ts +213 -0
- package/dist/runtime/runtime-cpp/utils/index.ts +63 -0
- package/dist/runtime/runtime-cpp/utils/info.ts +123 -0
- package/dist/runtime/runtime-cpp/utils/page.ts +12 -0
- package/dist/runtime/runtime-cpp/utils/router.ts +1 -0
- package/dist/runtime/runtime-harmony/apis/helper.ets +33 -0
- package/dist/runtime/runtime-harmony/apis/network/common.ets +41 -0
- package/dist/runtime/runtime-harmony/apis/network/downloadFile.ets +327 -0
- package/dist/runtime/runtime-harmony/apis/network/index.ets +58 -0
- package/dist/runtime/runtime-harmony/apis/network/request.ets +206 -0
- package/dist/runtime/runtime-harmony/apis/network/uploadFile.ets +190 -0
- package/dist/runtime/runtime-harmony/apis/route.ets +110 -0
- package/dist/runtime/runtime-harmony/apis/taskpool.ets +149 -0
- package/dist/runtime/runtime-harmony/index.ets +41 -0
- package/dist/runtime/runtime-harmony/utils.ts +53 -0
- package/package.json +24 -23
- package/LICENSE +0 -174
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Current, getPageScrollerOrNode } from '@tarojs/runtime'
|
|
2
|
+
|
|
3
|
+
import { NodesRef } from './nodesRef'
|
|
4
|
+
|
|
5
|
+
import type { TaroAny } from '@tarojs/runtime'
|
|
6
|
+
import type Taro from '@tarojs/taro/types'
|
|
7
|
+
|
|
8
|
+
interface ISelectorQueryQueue {
|
|
9
|
+
component: any
|
|
10
|
+
selector: string
|
|
11
|
+
single: boolean
|
|
12
|
+
fields
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type TSelectorQueryQueueCallback = (res: ISelectorQueryQueue) => void
|
|
16
|
+
|
|
17
|
+
// 从 TaroNode 里找到对应的 fields 内容
|
|
18
|
+
function filter (fields, dom) {
|
|
19
|
+
if (!dom) return null
|
|
20
|
+
const {
|
|
21
|
+
id,
|
|
22
|
+
dataset,
|
|
23
|
+
rect,
|
|
24
|
+
size,
|
|
25
|
+
scrollOffset,
|
|
26
|
+
properties = [],
|
|
27
|
+
computedStyle = [],
|
|
28
|
+
nodeCanvasType,
|
|
29
|
+
node,
|
|
30
|
+
context
|
|
31
|
+
} = fields
|
|
32
|
+
const res: any = {}
|
|
33
|
+
if (node) {
|
|
34
|
+
if (nodeCanvasType) { // Node节点获取处理
|
|
35
|
+
const typeName = dom.nodeName
|
|
36
|
+
res.node = {
|
|
37
|
+
id: dom.id,
|
|
38
|
+
$taroElement: dom
|
|
39
|
+
}
|
|
40
|
+
if (/^canvas/i.test(typeName)) {
|
|
41
|
+
// harmony todo canvas attr type
|
|
42
|
+
const canvasType = dom._attrs.type || ''
|
|
43
|
+
res.nodeCanvasType = canvasType
|
|
44
|
+
if (/^(2d|webgl)/i.test(canvasType) && dom) {
|
|
45
|
+
res.node = dom
|
|
46
|
+
} else {
|
|
47
|
+
res.node = null
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
// TODO https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html
|
|
51
|
+
// if (/^taro-scroll-view-core/i.test(tagName))
|
|
52
|
+
res.nodeCanvasType = ''
|
|
53
|
+
res.node = dom
|
|
54
|
+
}
|
|
55
|
+
return res
|
|
56
|
+
} else {
|
|
57
|
+
res.node = dom
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (context) {
|
|
61
|
+
// TODO: 暂未实现获取 context
|
|
62
|
+
// const typeName = dom.type
|
|
63
|
+
// if (/^video/i.test(typeName)) {
|
|
64
|
+
// return { context: dom }
|
|
65
|
+
// } else if (/^canvas/i.test(typeName)) {
|
|
66
|
+
// const type = dom.type || '2d'
|
|
67
|
+
// // harmony todo canvas context
|
|
68
|
+
// const ctx = dom?.getContext(type)
|
|
69
|
+
// return { context: ctx }
|
|
70
|
+
// } else if (/^taro-live-player-core/i.test(typeName)) {
|
|
71
|
+
// console.error('暂时不支持通过 NodesRef.context 获取 LivePlayerContext')
|
|
72
|
+
// } else if (/^taro-editor-core/i.test(typeName)) {
|
|
73
|
+
// console.error('暂时不支持通过 NodesRef.context 获取 EditorContext')
|
|
74
|
+
// } else if (/^taro-map-core/i.test(typeName)) {
|
|
75
|
+
// console.error('暂时不支持通过 NodesRef.context 获取 MapContext')
|
|
76
|
+
// }
|
|
77
|
+
}
|
|
78
|
+
if (id) res.id = dom.id
|
|
79
|
+
|
|
80
|
+
if (dataset) res.dataset = Object.assign({}, dom.dataset)
|
|
81
|
+
|
|
82
|
+
if (rect || size) {
|
|
83
|
+
const computedStyle = dom.getComputedStyle()
|
|
84
|
+
if (rect) {
|
|
85
|
+
res.top = computedStyle.globalY
|
|
86
|
+
res.left = computedStyle.globalX
|
|
87
|
+
res.right = res.left + computedStyle.width
|
|
88
|
+
res.bottom = res.top + computedStyle.height
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (size) {
|
|
92
|
+
res.width = computedStyle.width
|
|
93
|
+
res.height = computedStyle.height
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (scrollOffset) {
|
|
97
|
+
// FIXME 更新为新的获取方式获取组件参数
|
|
98
|
+
const result = Current.nativeModule.getCurrentOffset(dom)
|
|
99
|
+
|
|
100
|
+
if (result) {
|
|
101
|
+
const { xOffset, yOffset } = result
|
|
102
|
+
|
|
103
|
+
res.scrollLeft = xOffset
|
|
104
|
+
res.scrollTop = yOffset
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (properties.length) {
|
|
108
|
+
properties.forEach(prop => {
|
|
109
|
+
const attrs = dom._attrs
|
|
110
|
+
if (attrs[prop]) res[prop] = attrs[prop]
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
if (computedStyle.length) {
|
|
114
|
+
const styles = dom._st
|
|
115
|
+
computedStyle.forEach(key => {
|
|
116
|
+
const value = styles[key]
|
|
117
|
+
if (value) res[key] = value
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
return res
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function queryBat(queue, cb) {
|
|
124
|
+
const result: TaroAny = []
|
|
125
|
+
const taro = Current.taro
|
|
126
|
+
const page = taro.getCurrentInstance().page
|
|
127
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
128
|
+
|
|
129
|
+
if (!element) return null
|
|
130
|
+
|
|
131
|
+
const actions = queue.map((item) => {
|
|
132
|
+
const { component, selector, single, fields } = item
|
|
133
|
+
return new Promise<void>(resolve => {
|
|
134
|
+
Current.nativeModule.querySelectDOM(component || page.node, selector, !single, (res) => {
|
|
135
|
+
if (res && res.length > 0) {
|
|
136
|
+
if (single) {
|
|
137
|
+
const dom = res[0]
|
|
138
|
+
result.push(filter(fields, dom))
|
|
139
|
+
} else {
|
|
140
|
+
result.push(res.map(dom => {
|
|
141
|
+
return filter(fields, dom)
|
|
142
|
+
}))
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
resolve()
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
Promise.all(actions).then(() => {
|
|
151
|
+
cb(result)
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export class SelectorQuery implements Taro.SelectorQuery {
|
|
156
|
+
_queue: ISelectorQueryQueue[]
|
|
157
|
+
_queueCb: (TSelectorQueryQueueCallback | null)[]
|
|
158
|
+
_component?: any
|
|
159
|
+
|
|
160
|
+
constructor () {
|
|
161
|
+
this._queue = []
|
|
162
|
+
this._queueCb = []
|
|
163
|
+
// this._component
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 设置选择器的选取范围
|
|
168
|
+
* @param component 指定组件
|
|
169
|
+
* @return selectQuery 返回查询对象
|
|
170
|
+
*/
|
|
171
|
+
in = (component: any) => {
|
|
172
|
+
this._component = component
|
|
173
|
+
return this
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 在当前页面下选择第一个匹配选择器selector的节点
|
|
178
|
+
* @param selector
|
|
179
|
+
* @return nodesRef 返回一个NodesRef 对象实例,可以用于获取节点信息
|
|
180
|
+
*/
|
|
181
|
+
select (selector: string) {
|
|
182
|
+
return new NodesRef(selector, this, true)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 在当前页面下选择匹配选择器selector的所有节点
|
|
187
|
+
* @param selector
|
|
188
|
+
*/
|
|
189
|
+
selectAll (selector: string) {
|
|
190
|
+
return new NodesRef(selector, this, false)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息
|
|
195
|
+
*/
|
|
196
|
+
selectViewport () {
|
|
197
|
+
return new NodesRef('.taro_page', this, true)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
exec (cb?: (...args: any[]) => any) {
|
|
201
|
+
queryBat(this._queue, res => {
|
|
202
|
+
const _queueCb = this._queueCb
|
|
203
|
+
res.forEach((item, index) => {
|
|
204
|
+
const cb = _queueCb[index]
|
|
205
|
+
typeof cb === 'function' && cb.call(this, item)
|
|
206
|
+
})
|
|
207
|
+
typeof cb === 'function' && cb.call(this, res)
|
|
208
|
+
})
|
|
209
|
+
return this as any
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
_push (selector, component, single, fields, callback: Taro.NodesRef.FieldsCallback | null = null) {
|
|
213
|
+
this._queue.push({
|
|
214
|
+
component,
|
|
215
|
+
selector,
|
|
216
|
+
single,
|
|
217
|
+
fields
|
|
218
|
+
})
|
|
219
|
+
this._queueCb.push(callback)
|
|
220
|
+
}
|
|
221
|
+
}
|