Explorar el Código

feat(runtime-core): respect function name when using `defineComponent` function shorthand (#1661)

Bjarki Hall hace 5 años
padre
commit
304830a764
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      packages/runtime-core/src/apiDefineComponent.ts

+ 3 - 1
packages/runtime-core/src/apiDefineComponent.ts

@@ -205,5 +205,7 @@ export function defineComponent<
 
 // implementation, close to no-op
 export function defineComponent(options: unknown) {
-  return isFunction(options) ? { setup: options } : options
+  return isFunction(options)
+    ? { setup: options, name: options.name }
+    : options
 }