提交 89593384 编写于 作者: fxy060608's avatar fxy060608

fix(mp-baidu): normalize event name (#3616)

上级 32a84553
import { customizeEvent } from '@dcloudio/uni-shared'
import {
ExpressionNode,
DirectiveNode,
......@@ -46,7 +47,13 @@ export function createTransformOn(
}
const value = res.props[0].value as ExpressionNode
res.props[0].value = createCustomEventExpr()
addEventOpts(arg.content, value, node)
addEventOpts(
node.tagType === ElementTypes.COMPONENT
? customizeEvent(arg.content)
: arg.content,
value,
node
)
return res
}
}
......
......@@ -22,10 +22,10 @@ describe('mp-baidu: transform v-on', () => {
}),
test(`multi custom event`, () => {
assert(
`<custom @unmount="unmount" @custom-mount="mount();created();"/>`,
`<custom bindunmount="__e" bindcustomMount="__e" u-i="2a9ec0b0-0" eO="{{a}}"/>`,
`<custom @unmount="unmount" @update:modelValue="changeHandle" @custom-mount="mount();created();"/>`,
`<custom bindunmount="__e" bindupdateModelValue="__e" bindcustomMount="__e" u-i="2a9ec0b0-0" eO="{{a}}"/>`,
`(_ctx, _cache) => {
return { a: { 'custom-mount': _o($event => { _ctx.mount(); _ctx.created(); }), 'unmount': _o(_ctx.unmount) } }
return { a: { 'updateModelValue': _o(_ctx.changeHandle), 'customMount': _o($event => { _ctx.mount(); _ctx.created(); }), 'unmount': _o(_ctx.unmount) } }
}`
)
})
......
......@@ -45,7 +45,7 @@ describe('mp-kuaishou: transform v-on', () => {
`<custom @unmount="unmount" @custom-mount="mount();created();"/>`,
`<custom bindunmount="__e" bindcustomMount="__e" u-i="2a9ec0b0-0" bind:__l="__l" eO="{{a}}"/>`,
`(_ctx, _cache) => {
return { a: { 'custom-mount': _o($event => { _ctx.mount(); _ctx.created(); }), 'unmount': _o(_ctx.unmount) } }
return { a: { 'customMount': _o($event => { _ctx.mount(); _ctx.created(); }), 'unmount': _o(_ctx.unmount) } }
}`
)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册