From f7e0821dc62292e30a263dad755f13dd1c22d11c Mon Sep 17 00:00:00 2001 From: Phlegx Systems OG Date: Thu, 17 Sep 2020 09:52:48 +0200 Subject: [PATCH] inject: check first if Vue prototype key exists. --- packages/@uvue/core/lib/initApp.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@uvue/core/lib/initApp.js b/packages/@uvue/core/lib/initApp.js index c4d6ffe..8e02c7f 100644 --- a/packages/@uvue/core/lib/initApp.js +++ b/packages/@uvue/core/lib/initApp.js @@ -26,7 +26,10 @@ export default async (options, context) => { // Inject function const inject = (key, value) => { if (!/^\$/.test(key)) key = `$${key}`; - context[key] = Vue.prototype[key] = value; + context[key] = value; + if (!Object.prototype.hasOwnProperty.call(Vue.prototype, key)) { + Vue.prototype[key] = value; + } if (options.store) { options.store[key] = value; }