Prevent open when click v-btn in v-expansion-panel headers

自古美人都是妖i 提交于 2020-02-22 19:08:48

问题


test (e) {
  e.preventDefault()
  console.log('foo')
},
<v-expansion-panel>
  <v-expansion-panel-content>
    <div slot="header">
      <v-btn icon flat @click="test($event)"><v-icon>add</v-icon></v-btn>
      title
    </div>
    <contents />
  </v-expansion-panel-content>
</v-expansion-panel>

This is v-expansion-panel with action button in it's header.

When I click action button, expansion panel is opened.

Can I have expansion panel doesn't open when I click the button?


回答1:


By using @click.native.stop on v-btn your button click will work and your expansion panel will not open.




回答2:


The simplest way is by using @click.stop=""




回答3:


Sorry.

I didn't know stopPropagation method.



来源:https://stackoverflow.com/questions/51710528/prevent-open-when-click-v-btn-in-v-expansion-panel-headers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!