F
F
FrozenSteel2019-08-10 21:57:21
Vue.js
FrozenSteel, 2019-08-10 21:57:21

Why are Vue component events not working in conjunction with Laravel?

Hello I
started learning Vue in conjunction with Laravel and came across the inability to make an elementary click on a button in a component.
The simplest button click component does not work at all, nothing errors

<template>
    <div class="container">
        <button id="colorButton" @click="start">Выбор по цвету</button>
    </div>
</template>
<script>
    export default {
        name: "ColorButton",
        methods: {
            start() {
                alert('');
            },
        },
        mounted() {
        },
    }
</script>
<style scoped>
</style>

App.js, there is also a container with app id in the template
Vue.component('color-button', require('./components/ColorButton.vue').default);
const app = new Vue({
    el: '#app',
});

Vue version 2.6.10 Laravel version 5.8

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question