Trigger click event in dialog button

 commentDialog() {
      const app = this.$f7;
          app.dialog.create({
        title: 'Write your comment!',
        text: '<textarea v-model="newComment" style="height:150px;" placeholder="Comment here..."></textarea>',
        buttons: [
          {
            text: '<button class="btn_new_cmnt" @click="addComment()">Send</button>',
          },
        ],
        verticalButtons: false,
      }).open();
    },

i need to trigger click while click on button

There is no such @click syntax in HTML and in JS, you need to add it manually:

const app = this.$f7;
const dialog = app.dialog.create({
  title: 'Write your comment!',
  text: '<textarea v-model="newComment" style="height:150px;" placeholder="Comment here..."></textarea>',
  buttons: [
    {
      text: '<button class="btn_new_cmnt" @click="addComment()">Send</button>',
    },
  ],
  verticalButtons: false,
  on: {
    open() {
      dialog.$el.find('.btn_new_cmnt').on('click', () => {
        addComment();
      });
    }
  }
}).open();
1 Like