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.
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');
});
$$('#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');
}
});