Przeglądaj źródła

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

Bjarki Hall 5 lat temu
rodzic
commit
304830a764
1 zmienionych plików z 3 dodań i 1 usunięć
  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
 }