Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/uni-mp-compiler/src/transforms/transformId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
type Expression,
callExpression,
identifier,
logicalExpression,
stringLiteral,
} from '@babel/types'
import {
Expand Down Expand Up @@ -48,7 +49,15 @@ export function rewriteId(
? expr
: identifier(rewriteExpression(idBindingProp.exp!, context).content)
} else {
idBindingExpr = stringLiteral('')
// 支付宝小程序组件上的虚拟id,不会直接透传到组件根节点上,导致无法正常触发 setElementId
idBindingExpr =
isX && process.env.UNI_PLATFORM === 'mp-alipay'
? logicalExpression(
'||',
identifier('_ctx.$scope.props.virtualHostId'),
stringLiteral('')
)
: stringLiteral('')
}
if (virtualHost) {
idBindingExpr = callExpression(
Expand Down
Loading