@@ -634,24 +634,17 @@ module.exports = {
634
634
if ( watcher . type === 'object' ) {
635
635
const property = watcher . property
636
636
if ( property . kind === 'init' ) {
637
- /** @type {Expression | null } */
638
- let handlerValueNode = null
639
- if ( property . value . type === 'ObjectExpression' ) {
640
- const handler = utils . findProperty ( property . value , 'handler' )
641
- if ( handler ) {
642
- handlerValueNode = handler . value
643
- }
644
- } else {
645
- handlerValueNode = property . value
646
- }
647
- if (
648
- handlerValueNode &&
649
- ( handlerValueNode . type === 'Literal' ||
650
- handlerValueNode . type === 'TemplateLiteral' )
651
- ) {
652
- const name = utils . getStringLiteralValue ( handlerValueNode )
653
- if ( name != null ) {
654
- watcherUsedProperties . add ( name )
637
+ for ( const handlerValueNode of utils . iterateWatchHandlerValues (
638
+ property
639
+ ) ) {
640
+ if (
641
+ handlerValueNode . type === 'Literal' ||
642
+ handlerValueNode . type === 'TemplateLiteral'
643
+ ) {
644
+ const name = utils . getStringLiteralValue ( handlerValueNode )
645
+ if ( name != null ) {
646
+ watcherUsedProperties . add ( name )
647
+ }
655
648
}
656
649
}
657
650
}
@@ -699,11 +692,11 @@ module.exports = {
699
692
if (
700
693
utils . getStaticPropertyName ( parentParentProperty ) !==
701
694
'computed' ||
702
- utils . getStaticPropertyName ( property ) !== 'handler '
695
+ utils . getStaticPropertyName ( property ) !== 'get '
703
696
) {
704
697
return
705
698
}
706
- // check { computed: { foo: { handler : (vm ) => vm.prop } } }
699
+ // check { computed: { foo: { get : () => vm.prop } } }
707
700
} else {
708
701
return
709
702
}
0 commit comments