H
H
hicale2021-05-14 13:08:04
Vue.js
hicale, 2021-05-14 13:08:04

The script does not work, I connect Vue via cdn (v 2.5.10). What could be the problem?

<div  class="container" id="app">

    <div class="wrapper">

        <h1 class="caption">It's event time! Click on button!</h1>

        <button class="button" v-on:click="onClick">Press me</button>

    </div>

</div>


new Vue({
    el: "#app",
    method: {
        onClick: function () {
            alert('Hi, it\'s me!')
        }
    }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IgorVader, 2021-05-14
@hicale

You should replace method with methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question