This repository was archived by the owner on Dec 25, 2024. It is now read-only.
File tree 3 files changed +24
-5
lines changed
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ export function getIdentifierUsages(node?: Expression | TSType | SpreadElement |
69
69
}
70
70
else if ( node . type === 'MemberExpression' || node . type === 'OptionalMemberExpression' ) {
71
71
getIdentifierUsages ( node . object , identifiers )
72
+ if ( node . computed )
73
+ getIdentifierUsages ( node . property , identifiers )
72
74
}
73
75
else if ( node . type === 'CallExpression' || node . type === 'OptionalCallExpression' ) {
74
76
getIdentifierUsages ( node . callee as Expression , identifiers )
Original file line number Diff line number Diff line change @@ -810,24 +810,36 @@ export default __sfc_main;
810
810
exports[`transform fixtures test/fixtures/TemplateOptionalChaining.vue 1`] = `
811
811
" <template>
812
812
<div @click=\\"callback?.()\\">
813
- { { text?.length ?? textLengthDefault }}
813
+ { { text?.length ?? textLengthDefault?.[index] }}
814
814
{ { classes?.[0] }}
815
+ { { arrayObj.data.value[i] }}
815
816
</div>
816
817
</template>
817
818
818
819
<script lang =\\"ts\\">
820
+ import { ref } from ' @vue/composition-api' ;
819
821
const __sfc_main = { } ;
820
822
821
823
__sfc_main.setup = (__props, __ctx) => {
822
824
const text = ' hello' ;
823
- const textLengthDefault = 0 ;
825
+ const textLengthDefault = ' ' ;
826
+ const index = ref (0 );
824
827
const callback = (undefined as undefined | (() => void ));
825
828
const classes = (undefined as undefined | string []);
829
+ const arrayObj = {
830
+ data: {
831
+ value: [1 , 2 , 3 ]
832
+ }
833
+ };
834
+ const i = 0 ;
826
835
return {
827
836
text ,
828
837
textLengthDefault ,
838
+ index ,
829
839
callback ,
830
- classes
840
+ classes ,
841
+ arrayObj ,
842
+ i
831
843
};
832
844
} ;
833
845
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div @click =" callback?.()" >
3
- {{ text?.length ?? textLengthDefault }}
3
+ {{ text?.length ?? textLengthDefault?.[index] }}
4
4
{{ classes?.[0] }}
5
+ {{ arrayObj.data.value[i] }}
5
6
</div >
6
7
</template >
7
8
8
9
<script setup lang="ts">
10
+ import { ref } from ' @vue/composition-api'
9
11
const text = ' hello'
10
- const textLengthDefault = 0
12
+ const textLengthDefault = ' '
13
+ const index = ref (0 )
11
14
12
15
const callback = undefined as undefined | (() => void )
13
16
const classes = undefined as undefined | string []
17
+ const arrayObj = { data: { value: [1 , 2 , 3 ] } }
18
+ const i = 0
14
19
</script >
You can’t perform that action at this time.
0 commit comments