My app.js is currently receiving a value called gtotal. I am trying to pass this value to the orderForm.vue file but am facing some difficulties in achieving this.
require('./bootstrap');
window.Vue = require('vue');
window.EventBus = new Vue();
Vue.component('products', require('./components/products.vue'));
Vue.component('orders', require('./components/orders.vue'));
Vue.component('orderform', require('./components/orderForm.vue'));
const app = new Vue({
el: '#app',
data: {
viewOrderForm: false,
gtotal: 0
},
created() {
EventBus.$on('openOrderForm', (total) => {
this.viewOrderForm = true;
this.gtotal = total;
console.log(this.gtotal);
});
}
});
My goal in orderForm.vue is to assign the value of gtotal to an input field so that it can be saved to the Database.
<template>
<input type="hidden" value="gtotal">
</template>