-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
描述你的问题或希望得到什么支持
示例代码一:
`
const divRef = ref(null)
async function testClick() {
ConsoleModule.log('hippyohos - testClick rect1')
const rect1 = await Native.getBoundingClientRect(divRef.value, {
relToContainer: false
})
ConsoleModule.log('hippyohos - testClick rect1', rect1)
const rect2 = await Native.getBoundingClientRect(divRef.value, {
relToContainer: true
})
ConsoleModule.log('hippyohos - testClick rect2', rect2)
}
`
日志显示未返回 res
示例代码二:
`
<button
v-for="item in visibleList"
:key="item.name"
class="history-item"
@click="handleHistoryItemClick(item)"
ref="btnref"
>
{{ item.name }}
js 代码:
在一函数内的部分代码
ConsoleModule.log('hippyohos - calcTwoLineCount start')
await nextTick()
const nodes = historyRef.value?.childNodes.filter(n => n.tagName === 'button')
if (!nodes || !nodes.length) return
let baseY = null
let line = 1
let count = 0
ConsoleModule.log(
'hippyohos - calcTwoLineCount isfunction',
typeof Native.getBoundingClientRect
)
for (let i = 0; i < nodes.length; i++) {
try {
ConsoleModule.log('hippyohos - calcTwoLineCount try')
const rectPromise = Native.getBoundingClientRect(nodes[i])
const timeoutPromise = new Promise((_, reject) =>
setTimeout(
() => reject(new Error('getBoundingClientRect timeout')),
5000
)
)
const rect = await Promise.race([rectPromise, timeoutPromise])
ConsoleModule.log('hippyohos - calcTwoLineCount try res', rect)
} catch (e) {
ConsoleModule.error('hippyohos - calcTwoLineCount error:', e)
}
ConsoleModule.log('hippyohos - calcTwoLineCount normal....')
const rect = await Native.getBoundingClientRect(nodes[i])
ConsoleModule.log('hippyohos - calcTwoLineCount normal rect....', rect)
`
日志显示超时打印error,后续未打印 rect
鸿蒙原生集成的 SDK 版本是3.3.0,与之对应的 Hippy vue 集成的是 @hippy/vue-next v3.3.3,调用 Native.getBoundingClientRect(xxx) 未返回,但看官方 demo (demo-vue-native.vue )是正常的
请问鸿蒙端是有什么特殊设置吗?鸿蒙原生和 hippy vue ?
其他补充信息
鸿蒙原生集成的SDK 版本是3.3.0,与之对应的 Hippy vue 集成的是 @hippy/vue-next v3.3.3,调用 Native.getBoundingClientRect(xxx) 未返回,但看官方demo 是正常的
请问鸿蒙端是有什么特殊设置吗?鸿蒙原生和hippy vue?
iOS Android 集成的sdk 是2.xxx的,对应的 Hippy vue (2.17.xxx"@hippy/vue-next v2.17-latest,是正常的。