2017-04-20 23 views

回答

0

據我所知,Vue.js中沒有這樣的選項。

您可以依次使用自定義指令來實現它:https://jsfiddle.net/wostex/63t082p2/35/

<div id="app"> 
    <button v-noctrl:click="sayHi">Say hi</button> 
</div> 

new Vue({ 
    el: '#app', 
    directives: { 
    'noctrl': { 
     bind(el,binding,vnode) { 
     if (binding.arg === 'click') { 
      el.addEventListener(binding.arg, function(event) { 
      if (!event.ctrlKey) { 
       event.preventDefault(); 
       binding.value.call(this); 
      }  
      }); 
     } 
     } 
    } 
    }, 
    methods: { 
    sayHi() { 
     console.log('Hi'); 
    } 
    } 
}); 
0

不,我們目前沒有這樣的功能。

您已檢查自己的回調方法。