From 6ec1d4ebb29e817a0ed5f408eb104f7f82ecdb18 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Thu, 1 Oct 2020 08:57:40 +0800 Subject: [PATCH] Update src/runtime/slot/index.ts Co-authored-by: Luke Edwards --- src/runtime/slot/index.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/runtime/slot/index.ts b/src/runtime/slot/index.ts index f80e0543ef..deef2f1bb5 100644 --- a/src/runtime/slot/index.ts +++ b/src/runtime/slot/index.ts @@ -22,14 +22,11 @@ function create_root_slot_fn(elements) { }; } -export function createSlot(slots) { - const root_slots = {}; - for (const slot_name in slots) { - let elements = slots[slot_name]; - if (!Array.isArray(elements)) { - elements = [elements]; - } - root_slots[slot_name] = [create_root_slot_fn(elements)]; +export function createSlot(input) { + var key, tmp, slots={}; + for (key in input) { + tmp = input[key]; + slots[key] = [create_root_slot_fn(Array.isArray(tmp) ? tmp : [tmp])]; } - return root_slots; + return slots; }