I know that is supersimple to access and set Vue instance properties if it is done like that:
var vm1 = new Vue({
el: '#vm1',
data: {
name: 'Vue Instance #1'
}
});
Then we can do something like vm1.whatever = 1
(example is taken from here: https://codingexplained.com/coding/front-end/vue-js/accessing-vue-instance-outside-declaration)
But what if we do it in a more normal way:
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount('#rank_app')
What is the way to set some data externally? I found very ugly way:
import Vue from 'vue'
import App from './App.vue'
window.rankVue = new Vue({
render: h => h(App)
}).$mount('#rank_app')
and then I can set the data from outside by:
window.rankVue.$children[0].error= true;
I wonder if there are less ugly solutions. (I am aware that it is a bad practice, but believe me there is no other way - I am in Django, and templates + form to submit is provided not by me, so I need to change error
variable used to render vue instance when the form submitted etc.)