Vue.js (3) learns the event listener: V-ON

The code is as follows:

<! DOCTYPEhtml>
<html>

<head>

    <meta name="viewport" content="Initial - scale = 1.0, the maximum - scale = 1, the user - scalable = no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="test1">
        <button v-on:click="showHello">{{message}}</button>
    </div>
</body>

</html>
<script>
    var test1 = new Vue({
        el: '#test1'.data: {
            message: 'Popup prompt'
        },
        methods: {
            showHello: function () {
                alert("Pop up."); }}})</script>
Copy the code

The effect is as follows:

Copy paste, open the web page operation can see the effect ~