I have an (unchangeable) DOM structure as followed:
<div id=indexVue>
...
<div id=childVue>
...
</div>
...
</div>
And two js files:
index.js:
var child = require('childVue');
module.exports = new Vue({
el: '#indexVue',
...
});
childVue.js:
module.exports = new Vue({
el: '#childVue',
methods: {
something: function(){
// Parent data needed here ...
},
...
}
});
As shown, I need the data of the indexVue
in childVue
. Is there any way to pass it to it? I tried to pass it to a function with (v-on=click: childFunction($data))
, but that only (logically) returns the data attribute from the childVue
and not from the indexVue
.
Google does not really help, as Vue is not well-documented.
The real file and DOM structure are way bigger and more complicated, but necessary for my problem are only these files.
Also I am not allowed to use jQuery here, which would make it a task of seconds.