From 5d78233683157cb06030cf69fb8eb44de2e15b34 Mon Sep 17 00:00:00 2001 From: JP Date: Sat, 30 Nov 2019 16:43:37 +0100 Subject: [PATCH] Check if parentVal is array or not --- src/core/util/options.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/util/options.js b/src/core/util/options.js index 243567859de..fe44ae800d5 100644 --- a/src/core/util/options.js +++ b/src/core/util/options.js @@ -144,12 +144,14 @@ strats.data = function ( * Hooks and props are merged as arrays. */ function mergeHook ( - parentVal: ?Array, + parentVal: ?Function | ?Array, childVal: ?Function | ?Array ): ?Array { const res = childVal ? parentVal - ? parentVal.concat(childVal) + ? Array.isArray(parentVal) + ? parentVal.concat(childVal) + : [parentVal].concat(childVal) : Array.isArray(childVal) ? childVal : [childVal]