v-on 监听多个方法

<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title></title>
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
        <style type="text/css">
            a {
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <p> {{msg}}</p>
            <button @click="a(),b()">点我ab</button>
            <br>
            <a  v-on='{click:DoSomething,mouseleave:MouseLeave}'>doSomething</a>
        </div>
    </body>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    msg: 'hello world'
                }
            },
            methods: {
                a() {
                    console.log('aa')
                },
                b() {
                    console.log('bbb')
                },
                DoSomething() {
                    console.log('123')
                },
                MouseLeave() {
                    console.log('mouseleave')
                }
            }
        })
    </script>
</html>
原文地址:https://www.cnblogs.com/lxsunny/p/14412113.html