Skip to content

Commit 48597d2

Browse files
author
yushijie1
committed
feat(dataset): 修复clickview无法注入dataset问题
1 parent f4918ff commit 48597d2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/taro-plugin-html/src/runtime.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ hooks.tap('modifySetAttrPayload', (element, key, payload, componentsAlias) => {
8888
element.enqueueUpdate({
8989
path: dataPath,
9090
value: payload.value ? catchViewAlias : (
91-
element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : staticViewAlias)
91+
element.isOnlyClickBinded() && !isHasExtractProp(element) ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : staticViewAlias)
9292
)
9393
})
9494
} else if (isHasExtractProp(element) && !element.isAnyEventBinded()) {
@@ -140,7 +140,7 @@ hooks.tap('modifyRmAttrPayload', (element, key, payload, componentsAlias) => {
140140
// catch-view => view or click-view or static-view or pure-view
141141
element.enqueueUpdate({
142142
path: dataPath,
143-
value: element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias))
143+
value: element.isOnlyClickBinded() && !isHasExtractProp(element) ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias))
144144
})
145145
} else if (!isHasExtractProp(element)) {
146146
// static-view => pure-view

packages/taro-plugin-html/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function getMappedType (nodeName: string, rawProps: Record<string, any>,
4242
if (!node) {
4343
return 'view'
4444
}
45-
if (node.isOnlyClickBinded()) {
45+
if (node.isOnlyClickBinded() && !isHasExtractProp(node)) {
4646
return 'click-view'
4747
} else if (node.isAnyEventBinded()) {
4848
return 'view'

packages/taro-runtime/src/dom/element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class TaroElement extends TaroNode {
211211
this.enqueueUpdate({
212212
path: `${_path}.${Shortcuts.NodeName}`,
213213
value: value ? catchViewAlias : (
214-
this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
214+
this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
215215
)
216216
})
217217
} else if (isPureView && isHasExtractProp(this)) {
@@ -281,7 +281,7 @@ export class TaroElement extends TaroNode {
281281
// catch-view => view or click-view or static-view or pure-view
282282
this.enqueueUpdate({
283283
path: `${_path}.${Shortcuts.NodeName}`,
284-
value: this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
284+
value: this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
285285
})
286286
} else if (isStaticView && !isHasExtractProp(this)) {
287287
// static-view => pure-view

packages/taro-runtime/src/hydrate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function hydrate (node: TaroElement | TaroText): MiniData {
6161
}
6262
}
6363

64-
if (nodeName === VIEW && node.isOnlyClickBinded()) {
64+
if (nodeName === VIEW && node.isOnlyClickBinded() && !isHasExtractProp(node)) {
6565
data[Shortcuts.NodeName] = CLICK_VIEW
6666
}
6767
}

0 commit comments

Comments
 (0)