From 3e0fbcdd1e463e00eab0f24638af9aa6beaf0b2e Mon Sep 17 00:00:00 2001 From: Manuel Saelices Date: Mon, 13 Jan 2020 10:51:03 +0100 Subject: [PATCH 1/2] chore(samples): add sample app for reproducing #595 --- samples/app/595.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 samples/app/595.js diff --git a/samples/app/595.js b/samples/app/595.js new file mode 100644 index 00000000..0cd50d6d --- /dev/null +++ b/samples/app/595.js @@ -0,0 +1,36 @@ +const Vue = require('nativescript-vue') + +Vue.config.debug = true +Vue.config.silent = false + +Plugin = { + install(Vue, name) { + Vue.prototype.$name = name + + Vue.mixin({ + beforeCreate: function() { + setTimeout(() => { + console.log('this.$options: ', this.$options) + }, 5000) + } + }) + } +} + +Vue.use(Plugin, 'pluginName') + +new Vue({ + data: {}, + template: ` + + + + + + + + + ` +}).$start() From ef388743ab401acc658d53d7d419c7cb6d8b6035 Mon Sep 17 00:00:00 2001 From: Manuel Saelices Date: Mon, 13 Jan 2020 10:56:46 +0100 Subject: [PATCH 2/2] fix: fix "TypeError: Cannot read property 'nativeView' of undefined" accessing this.$options --- platform/nativescript/runtime/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/nativescript/runtime/index.js b/platform/nativescript/runtime/index.js index 949cabc8..be263d72 100644 --- a/platform/nativescript/runtime/index.js +++ b/platform/nativescript/runtime/index.js @@ -79,7 +79,7 @@ Vue.prototype.$start = function() { // Define a `nativeView` getter in every NS vue instance Object.defineProperty(Vue.prototype, 'nativeView', { get() { - return this.$el.nativeView + return this.$el ? this.$el.nativeView : undefined } })