I am trying to send a value from my web component to the Vue instance and then use it in a Rails html.erb file. The element where I am mounting the Vue instance is shown below:
<div id="app" :purchaseId="1">
However, I have been unsuccessful in passing the value to the Vue instance. The Vue instance is defined in main.js
as follows:
export default new Vue({
store,
vuetify,
render: h => h(App),
data: {
purchaseId: null
},
methods: {
setJson(payload) {
console.log("payload", payload);
this.purchaseId = payload;
}
}
}).$mount("#app");
My ultimate goal is to pass this value to a child component. Can anyone provide guidance on how to achieve this?