Skip to content

Commit

Permalink
feat(dataset): 修复clickview无法注入dataset问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yushijie1 committed Dec 27, 2024
1 parent f4918ff commit 48597d2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/taro-plugin-html/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ hooks.tap('modifySetAttrPayload', (element, key, payload, componentsAlias) => {
element.enqueueUpdate({
path: dataPath,
value: payload.value ? catchViewAlias : (
element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : staticViewAlias)
element.isOnlyClickBinded() && !isHasExtractProp(element) ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : staticViewAlias)
)
})
} else if (isHasExtractProp(element) && !element.isAnyEventBinded()) {
Expand Down Expand Up @@ -140,7 +140,7 @@ hooks.tap('modifyRmAttrPayload', (element, key, payload, componentsAlias) => {
// catch-view => view or click-view or static-view or pure-view
element.enqueueUpdate({
path: dataPath,
value: element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias))
value: element.isOnlyClickBinded() && !isHasExtractProp(element) ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias))
})
} else if (!isHasExtractProp(element)) {
// static-view => pure-view
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-plugin-html/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function getMappedType (nodeName: string, rawProps: Record<string, any>,
if (!node) {
return 'view'
}
if (node.isOnlyClickBinded()) {
if (node.isOnlyClickBinded() && !isHasExtractProp(node)) {
return 'click-view'
} else if (node.isAnyEventBinded()) {
return 'view'
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-runtime/src/dom/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class TaroElement extends TaroNode {
this.enqueueUpdate({
path: `${_path}.${Shortcuts.NodeName}`,
value: value ? catchViewAlias : (
this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
)
})
} else if (isPureView && isHasExtractProp(this)) {
Expand Down Expand Up @@ -281,7 +281,7 @@ export class TaroElement extends TaroNode {
// catch-view => view or click-view or static-view or pure-view
this.enqueueUpdate({
path: `${_path}.${Shortcuts.NodeName}`,
value: this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
value: this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
})
} else if (isStaticView && !isHasExtractProp(this)) {
// static-view => pure-view
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-runtime/src/hydrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function hydrate (node: TaroElement | TaroText): MiniData {
}
}

if (nodeName === VIEW && node.isOnlyClickBinded()) {
if (nodeName === VIEW && node.isOnlyClickBinded() && !isHasExtractProp(node)) {
data[Shortcuts.NodeName] = CLICK_VIEW
}
}
Expand Down

0 comments on commit 48597d2

Please sign in to comment.