File tree 4 files changed +20
-3
lines changed
devtools-kit/src/core/component/utils
components/IndexComponent
4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ import { basename, classify } from '@vue/devtools-shared'
3
3
import { Fragment } from '../../../shared/stub-vue'
4
4
5
5
function getComponentTypeName ( options : VueAppInstance [ 'type' ] ) {
6
- return options . name || options . _componentTag || options . __VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options . __name
6
+ const name = options . name || options . _componentTag || options . __VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options . __name
7
+ if ( name === 'index' && options . __file ?. endsWith ( 'index.vue' ) ) {
8
+ return ''
9
+ }
10
+ return name
7
11
}
8
12
9
13
function getComponentFileName ( options : VueAppInstance [ 'type' ] ) {
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ const text = ref (' Index' )
3
+ </script >
4
+
5
+ <template >
6
+ <div >
7
+ {{ text }} Component
8
+ </div >
9
+ </template >
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import Foo from ' ../components/Foo.vue'
3
+ import IndexComponent from ' ../components/IndexComponent/index.vue'
3
4
4
5
const visible = ref (false )
5
6
@@ -23,6 +24,7 @@ const toRefObj = toRefs(obj)
23
24
<div class =" m-auto mt-3 h-80 w-120 flex flex-col items-center justify-center rounded bg-[#363636]" >
24
25
Home
25
26
<Foo v-if =" visible" />
27
+ <IndexComponent v-if =" visible" />
26
28
<img src =" /vite.svg" alt =" Vite Logo" >
27
29
<button class =" w-30 cursor-pointer" @click =" visible = !visible" >
28
30
Toggle Foo
Original file line number Diff line number Diff line change @@ -28,10 +28,12 @@ export function kebabize(str: string) {
28
28
}
29
29
30
30
export function basename ( filename : string , ext : string ) : string {
31
- const normalizedFilename = filename . replace ( / ^ [ a - z ] : / i, '' ) . replace ( / \\ / g, '/' )
31
+ let normalizedFilename = filename . replace ( / ^ [ a - z ] : / i, '' ) . replace ( / \\ / g, '/' )
32
+ if ( normalizedFilename . endsWith ( `index${ ext } ` ) ) {
33
+ normalizedFilename = normalizedFilename . replace ( `/index${ ext } ` , ext )
34
+ }
32
35
const lastSlashIndex = normalizedFilename . lastIndexOf ( '/' )
33
36
const baseNameWithExt = normalizedFilename . substring ( lastSlashIndex + 1 )
34
-
35
37
if ( ext ) {
36
38
const extIndex = baseNameWithExt . lastIndexOf ( ext )
37
39
return baseNameWithExt . substring ( 0 , extIndex )
You can’t perform that action at this time.
0 commit comments