[Vuejs]-Sending params from Vue to Laravel controller to update props

0👍

It seems that you are asking about the best way to implement the submission of the user’s card value?

I’m not sure why there is only one card, but to submit the value of that card here’s an example (I don’t think you can use blade directives in Vue)

https://v2.vuejs.org/v2/api/#ref

https://v2.vuejs.org/v2/guide/events.html#Listening-to-Events

https://v2.vuejs.org/v2/guide/events.html#Event-Modifiers

<div
    class="flex-left"
    v-on:click="$refs.card_form.submit()"
    style="cursor: pointer;"
>
    <form
        v-on:submit.prevent="submitCard(1)"
        ref="card_form"
        method="post"
    >
        <img src="https://image.flaticon.com/icons/svg/188/188234.svg" height="50" width="50" />
    </form>
</div>
export default{
    methods:{
        submitCard(card_value){
            axios.post('/values',{ userValue:card_value }) //not sure what your endpoint is
            .then(response=>{
                window.alert('value submitted')
            })
        }
    }

}

Leave a comment