Vue-material: Event Handlers do not work on Vue Material Comps

Created on 6 Mar 2017  路  3Comments  路  Source: vuematerial/vue-material

Steps to reproduce

If you add an event handler directly on a material comp, it will not fire.
If you wrap the material comp in a DOM element, the events on the element fire.

<div @click="hitme"><md-button>THIS HANDER FIRES</md-button></div>
<md-button @click="hitme">THIS HANDER NEVER FIRES</md-button>

Vue.use(VueMaterial)

var App = new Vue({
  el: '#app',
  methods:{
    hitme:function(){
      console.log("hit me called")
    }
  }
})

Which browser?

all

What is expected?

click handlers work

What is actually happening?

click handlers directly on Vue Material components do not work.

Reproduction Link

http://codepen.io/__ted__/pen/PpGpaB

Most helpful comment

You need use native handlers on every vue component @click.native="hitme"

All 3 comments

You need use native handlers on every vue component @click.native="hitme"

Thanks!

You need use native handlers on every vue component @click.native="hitme"

here it is, buried in the Vue docs: https://vuejs.org/v2/guide/components.html#Binding-Native-Events-to-Components

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipfeldmann picture philipfeldmann  路  3Comments

korylprince picture korylprince  路  3Comments

sandhose picture sandhose  路  3Comments

lovepluskaka picture lovepluskaka  路  3Comments

delueg picture delueg  路  3Comments