Browse Source

refactor(compiler-vapor): remove Object.entries

三咲智子 Kevin Deng 2 years ago
parent
commit
c97dee3e3c
1 changed files with 3 additions and 3 deletions
  1. 3 3
      packages/compiler-vapor/src/generators/component.ts

+ 3 - 3
packages/compiler-vapor/src/generators/component.ts

@@ -148,10 +148,10 @@ function genModelModifiers(
 }
 
 function genSlots(slots: ComponentSlots, context: CodegenContext) {
-  const slotList = Object.entries(slots)
+  const names = Object.keys(slots)
   return genMulti(
-    slotList.length > 1 ? DELIMITERS_OBJECT_NEWLINE : DELIMITERS_OBJECT,
-    ...slotList.map(([name, slot]) => [name, ': ', ...genBlock(slot, context)]),
+    names.length > 1 ? DELIMITERS_OBJECT_NEWLINE : DELIMITERS_OBJECT,
+    ...names.map(name => [name, ': ', ...genBlock(slots[name], context)]),
   )
 }