File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
src/platforms/mp/compiler/codegen/convert Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,15 @@ export default {
115
115
wxmlEventName = eventMap . map [ eventName ]
116
116
}
117
117
118
- wxmlEventName = ( eventNameMap . includes ( 'stop' ) ? 'catch' : 'bind' ) + ( wxmlEventName || eventName )
118
+ let eventType = 'bind'
119
+ const isStop = eventNameMap . includes ( 'stop' )
120
+ if ( eventNameMap . includes ( 'capture' ) ) {
121
+ eventType = isStop ? 'capture-catch:' : 'capture-bind:'
122
+ } else if ( isStop ) {
123
+ eventType = 'catch'
124
+ }
125
+
126
+ wxmlEventName = eventType + ( wxmlEventName || eventName )
119
127
attrs [ wxmlEventName ] = 'handleProxy'
120
128
121
129
return attrs
Original file line number Diff line number Diff line change @@ -320,6 +320,30 @@ describe('事件', () => {
320
320
)
321
321
} )
322
322
323
+ it ( '@click.stop' , ( ) => {
324
+ assertCodegen (
325
+ `<a @click.stop="ddd"></a>` ,
326
+ `<template name="a"><view catchtap="handleProxy" data-eventid="{{'0'}}" data-comkey="{{$k}}" class="_a"></view></template>` ,
327
+ { name : 'a' }
328
+ )
329
+ } )
330
+
331
+ it ( '@click.stop.capture' , ( ) => {
332
+ assertCodegen (
333
+ `<a @click.stop.capture="ddd"></a>` ,
334
+ `<template name="a"><view capture-catch:tap="handleProxy" data-eventid="{{'0'}}" data-comkey="{{$k}}" class="_a"></view></template>` ,
335
+ { name : 'a' }
336
+ )
337
+ } )
338
+
339
+ it ( '@click.capture' , ( ) => {
340
+ assertCodegen (
341
+ `<a @click.capture="ddd"></a>` ,
342
+ `<template name="a"><view capture-bind:tap="handleProxy" data-eventid="{{'0'}}" data-comkey="{{$k}}" class="_a"></view></template>` ,
343
+ { name : 'a' }
344
+ )
345
+ } )
346
+
323
347
it ( '@load' , ( ) => {
324
348
assertCodegen (
325
349
`<a @load="ddd"></a>` ,
You can’t perform that action at this time.
0 commit comments