Skip to content

Commit

Permalink
fix(runtime): 支付宝小程序冒泡事件id拿取错误 (NervJS#14535)
Browse files Browse the repository at this point in the history
* feat: 支付宝小程序冒泡事件id拿取错误

微信小程序冒泡,在父节点onClick的event中可以取到子节点dataset中的data-值,
但是支付宝小程序中却是空

期望:支付宝小程序和微信小程序保持一致

* fix: 支付宝小程序冒泡事件id拿取错误

* chrore: 添加注释

---------

Co-authored-by: Zakary <zakarycode@gmail.com>
  • Loading branch information
SuJunming and ZakaryCode authored Sep 22, 2023
1 parent da5db02 commit 4ef3557
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/taro-runtime/src/dom/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export class TaroEvent {
const cacheTarget = this.cacheTarget
if (!cacheTarget) {
const target = Object.create(this.mpEvent?.target || null)

const element = env.document.getElementById(target.dataset?.sid || target.id || null)
// Note:优先判断冒泡场景alipay的targetDataset的sid, 不然冒泡场景target属性吐出不对,其余拿取当前绑定id
const element = env.document.getElementById(target.targetDataset?.sid || target.dataset?.sid || target.id || null)
target.dataset = element !== null ? element.dataset : EMPTY_OBJ

for (const key in this.mpEvent?.detail) {
Expand Down

0 comments on commit 4ef3557

Please sign in to comment.