b2nil / taro-ui-vue3

采用 Vue 3.0 重写的 Taro UI 组件库
https://b2nil.github.io/taro-ui-vue3/
MIT License
160 stars 51 forks source link

H5 Accordion 展开和收起动画异常 #29

Closed b2nil closed 4 years ago

b2nil commented 4 years ago

现象与 #13 一样。

原因是 H5 的点击事件为 MouseEvente.target.idnull, 导致 contentID 不是唯一。 可以将 e.timestamp 赋值给 contentID, 确保 contentID 是唯一的。

function handleClick(e: CommonEvent) {
    // contentID.value = 'content' + e.target.id
    contentID.value = 'content' + String(e.timeStamp).replace('.', '')
    ...
}