Skip to content

Commit

Permalink
fix: preferentially use the registered name in parent component inste…
Browse files Browse the repository at this point in the history
…ad of file name
  • Loading branch information
Azurewarth0920 committed Apr 8, 2023
1 parent 1b1d1d0 commit 888baf0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/app-backend-vue3/src/components/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export function getInstanceName (instance) {
for (const key in instance.appContext?.components) {
if (instance.appContext.components[key] === instance.type) return saveComponentName(instance, key)
}
const fileName = getComponentFileName(instance.type || {})
if (fileName) {
return fileName
}
return 'Anonymous Component'
}

Expand All @@ -45,10 +49,10 @@ function saveComponentName (instance, key) {
}

function getComponentTypeName (options) {
const name = options.name || options._componentTag || options.__vdevtools_guessedName || options.__name
if (name) {
return name
}
return options.name || options._componentTag || options.__vdevtools_guessedName || options.__name
}

function getComponentFileName (options) {
const file = options.__file // injected by vue-loader
if (file) {
return classify(basename(file, '.vue'))
Expand Down

0 comments on commit 888baf0

Please sign in to comment.