Vue.extend prototype
See original GitHub issueVersion
2.6.7
Reproduction link
https://repl.it/@Ti_webdev/Vue-extend
Steps to reproduce
const Vue2 = Vue.extend({})
Vue2.prototype.$foo = 'bar'
const Child = {
render (h) {
return h('h1', 'Hello Vue.extend! ' this.$foo)
}
}
new Vue2({
render (h) {
return h(Child)
},
el: "#app"
}).$mount()
What is expected?
Hello Vue.extend! bar
What is actually happening?
Hello Vue.extend! undefined
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Extending Vue - vue.js
prototype. The convention here is Vue instance methods should be prefixed with $ , so that they don't conflict with user data and...
Read more >How to use the vue.extend function in vue - Snyk
To help you get started, we've selected a few vue.extend examples, based on popular ways it is used in public projects.
Read more >Accessing properties globally in Vue.js with prototypes
Vue.js prototypes can vastly increase efficiency by letting you access properties globally instead of using multiple imports.
Read more >Adding Instance Properties to a Vue App | by John Au-Yeung
We can extend Vue 's prototype to add global properties and methods that we can use throughout our app. We must reference them...
Read more >How can create Vue.prototype from component?
AuthenDialog.install = (Vue, options) => { Object.defineProperty(Vue.prototype, '$authen', new Vue.extend(AuthenDialog)) }.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
that’s normal, Child is also extending Vue, you can make it extend Vue2 though:
Unfortunately I have more complicated case where your way does not work 😦 I want to isolate third-party library with code like in the example http://jsfiddle.net/vg8y5n34/3/