Migration from Vue2 to Vue3 with OptionAPI passing vm from outside not working anymore (data being a function) · Issue #13322 · vuejs/core · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started using view since version 1 and i'm stuck on version 2 due to a missing feature.
We alwasys loved the fact that Vue is not invasive in my codebases, thank to this property we could evolve the viewmodels for many years with very good efficiency and no errors.
In vue2 we have a lot of code that follow this structure, and it works very well :
var pageViewModel = new PageViewModelClass( /* paramerters or seed from server side rendering*/ )
var vueInstance = new Vue({
el: "#domId",
data: pageViewModel
});
I'm trying to migrate to vue3, but the following approach is not working anymore, and we really would not like to merge the business logic view model inside vue function, how can we keep using vue3 by passing an external view model to the vue instance ? The ideal would be something like this
createApp({
data() {
return vm;
},
methods : vm
}).mount('#app')
but the error reports "vue.esm-browser.js:2260 [Vue warn]: Property "increment" was accessed during render but is not defined on instance.
at " and ofc it does not work.
Thank you
long time vue lover looking forward to use vue3
What is expected?
i would like to make an instance of a view model and pass it to vue like we used to do with vue2.
What is actually happening?
not working
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered:
Vue version
3
Link to minimal reproduction
https://jsfiddle.net/superboy2k/qb3o7fka/1/
Steps to reproduce
I started using view since version 1 and i'm stuck on version 2 due to a missing feature.
We alwasys loved the fact that Vue is not invasive in my codebases, thank to this property we could evolve the viewmodels for many years with very good efficiency and no errors.
In vue2 we have a lot of code that follow this structure, and it works very well :
I'm trying to migrate to vue3, but the following approach is not working anymore, and we really would not like to merge the business logic view model inside vue function, how can we keep using vue3 by passing an external view model to the vue instance ? The ideal would be something like this
but the error reports "vue.esm-browser.js:2260 [Vue warn]: Property "increment" was accessed during render but is not defined on instance.
at " and ofc it does not work.
Thank you
long time vue lover looking forward to use vue3
What is expected?
i would like to make an instance of a view model and pass it to vue like we used to do with vue2.
What is actually happening?
not working
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: