【问题标题】:Vuetify framework: Toggle a badge from within a functionVuetify 框架:从函数中切换徽章
【发布时间】:2023-03-14 17:35:01
【问题描述】:

我需要通过一个名为 openNotifications 的函数来切换徽章。目前只能通过按钮切换徽章。

按钮:

<v-btn @click.native="show = !show">toggle badge</v-btn>

App.vue: 打开通知

<script>
  export default {
    methods: {
      openNotifications () {
        bus.$emit('dialog', true)
      }
[...]
</script>

如何在 openNotifications 函数中切换按钮?

【问题讨论】:

    标签: javascript vuejs2 toggle vuetify.js


    【解决方案1】:

    让 openNotifcations 函数执行与 @click 函数相同的操作,所以

    openNotifications () {
     this.show = !this.show 
    }
    

    【讨论】:

    • 非常感谢,我忘记了this部分。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-05
    • 2018-08-13
    • 2020-05-10
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    相关资源
    最近更新 更多