0👍
✅
Since you’ve got an event bus set up, you can listen for openOrderForm
in the component which has the order form:
<template>
...
<order-form :gtotal="gtotal"></order-form>
...
</template>
export default {
data () {
return {
gtotal: 0
}
},
created () {
EventBus.$on('openOrderForm',(total)=>{
this.gtotal = total;
})
}
}
Your order form would just need a prop
for gtotal
:
// orderForm.vue
<template>
<input type="hidden" :value="gtotal">
</template>
export default {
props: ['gtotal']
}
Source:stackexchange.com