How to call multiple function with v-on:click ?

How to call multiple function with v-on:click ?

Asked on November 14, 2018 in vue.js.
Add Comment


  • 1 Answer(s)

    Use short symbol @click as an alternative of v-on:click
    Use Click event handler which call other methods

    <div id="app">
        <div @click="handler('foo','bar')">
            Hi, click me!
        </div>
    </div>
    <!-- link to vue.js !-->
    <script src="vue.js"></script>
    <script>
        (function(){
            var vm = new Vue({
                el:'#app',
                methods:{
                    method1:function(arg){
                        console.log('method1: ',arg);
                    },
                    method2:function(arg){
                        console.log('method2: ',arg);
                    },
                    handler:function(arg1,arg2){
                        this.method1(arg1);
                        this.method2(arg2);
                    }
                 }
            })
        }());
    </script>
    
    Answered on November 14, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.