How to stop the popup before it pops up

I want to make some condition judgments through JavaScript, and in some cases, give the user an error prompt and not show “popup-about”.

var app = new Framework7();

var $$ = Dom7;

// DOM events for About popup
$$(’.popup-about’).on(‘popup:open’, function (e, popup) {
console.log(‘About popup open’);
});
$$(’.popup-about’).on(‘popup:opened’, function (e, popup) {
console.log(‘About popup opened’);
});

what do you need?
bcs the popup usually its open after some user interaction, so before open the popup just make your logic;

<button @click='openPopup(false)'> Dont Open <button>
<button @click='openPopup(true)'> Open <button>

function openPopup(open) {
  if (open) popup.open()
}

some context would be useful to understand your scenario.

I copied the code from the official document.
https://v2.framework7.io/docs/popup.html

Because I did not use dynamicPopup, I bound html element through dom7, I don’t know how to stop “popup: open”

var app = new Framework7();

var $$ = Dom7;

// DOM events for About popup
$$('.popup-about').on('popup:open', function (e, popup) {
  // my code
  if (myData.length > 100) {
    myApp.alert('Lite version cannot add more than 100 records');
    return
  }
  console.log('About popup open');
});
$$('.popup-about').on('popup:opened', function (e, popup) {
  console.log('About popup opened');
});

there is no such functionality on popups. Just change your logic to prevent open the popup before it start to open

function openPopup(open) {
  if (open) popup.open()
}

I have solved the problem.

$$('#thePopupLinkID').on('click', function () {
  if (myData.length > 100) {
    myApp.alert('Lite version cannot add more than 100 records');
    $$('#thePopupLinkID').removeClass('open-popup');
  } else {
    $$('#thePopupLinkID').addClass('open-popup');
  }
});