Vue-material: md-button @click do not work

Created on 18 Feb 2017  路  14Comments  路  Source: vuematerial/vue-material

I'm trying this code
http://jsbin.com/hejulu/edit?html,js,output
What is wrong with my code?

question

Most helpful comment

@click.native will work

All 14 comments

@click.native will work

@marcosmoura, I noticed a lot about this issue. It may be necessary to add the solution in the documentation? As an example of one of?

@cawa-93 its not issue but on components needs to be click with native

Thanks!

In my case, @click.native did not work, but v-on:click.native did ;)

Why it's not working? ".native" in Vue documentation explained as, "There may be times when you want to listen for a native event on the root element of a component. In these cases, you can use the .native modifier for v-on." However, vue-material using .native. It's a bit awkward though. Isn't it a vue- extension?

@flamedenise its weird because @click.native its shortcut of v-on:click.native

Using @click.native="$router.push('/homescreen')" with router-link tag I cannot visualize the button on a sidenav, anyone had the same problem?

@Chusynuk use without router link

          <router-link
            :to="{ path: '/homescreen' }"
            exact
          >
            ....
          </router-link>

This is the complete tag

tag="md-button" :to="{ path: './Requests' }" class="md-primary"

if I add the tag="md-button" I can visualize the button, but I doesn't work

This appears to be a breaking change, as it used to work OK (see https://www.youtube.com/watch?v=1j8xTOmR8pw).

It's because of the ink ripple component. The default behaviour comes back when you disable it:

Vue.material.inkRipple = false

Then, there should be a fix for it, right?

@enesunal That would be nice, but this was noted as a breaking change in v0.7.0

To avoid issues and conflicts between multiple events on buttons and other "clickable" components the internal @click event don't work anymore. Use @click.native instead.

Was this page helpful?
0 / 5 - 0 ratings