mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
BREAKING CHANGE: $ionicPopup.show()'s button onTap function has changed.
When using `$ionicPopup.show()`, previously a button's onTap function
would only result in closing the popup and resolving the promise if the
`onTap(event)` function returned a truthy value.
Now, a button's onTap event will *always* close the popup and resolve
the popup's promise, no matter the return value, by default. The only
way to prevent the popup from closing is to call
`event.preventDefault()`.
Change your code from this:
```js
$ionicPopup.show({
buttons: [{
onTap: function(event) {
if (!shouldClosePopup) {
return false;
}
}
}]
});
```
To this:
```js
$ionicPopup.show({
buttons: [{
onTap: function(event) {
if (!shouldClosePopup) {
event.preventDefault();
}
}
}]
});
```
92 lines
1.6 KiB
SCSS
92 lines
1.6 KiB
SCSS
|
|
/**
|
|
* Popups
|
|
* --------------------------------------------------
|
|
*/
|
|
|
|
.popup {
|
|
position: fixed;
|
|
top: 50%;
|
|
left: 50%;
|
|
z-index: $z-index-popup;
|
|
|
|
// Start hidden
|
|
visibility: hidden;
|
|
|
|
width: $popup-width;
|
|
max-width: 100%;
|
|
|
|
border-radius: $popup-border-radius;
|
|
background-color: $popup-background-color;
|
|
|
|
&.popup-hidden {
|
|
@include animation-name(scaleOut);
|
|
@include animation-duration($popup-leave-animation-duration);
|
|
@include animation-timing-function(ease-in-out);
|
|
@include animation-fill-mode(both);
|
|
}
|
|
|
|
&.popup-showing {
|
|
visibility: visible;
|
|
}
|
|
|
|
&.active {
|
|
@include animation-name(superScaleIn);
|
|
@include animation-duration($popup-enter-animation-duration);
|
|
@include animation-timing-function(ease-in-out);
|
|
@include animation-fill-mode(both);
|
|
}
|
|
}
|
|
|
|
.popup-head {
|
|
padding: 15px 0px;
|
|
border-bottom: 1px solid #eee;
|
|
text-align: center;
|
|
}
|
|
.popup-title {
|
|
margin: 0;
|
|
padding: 0;
|
|
font-size: 15px;
|
|
}
|
|
.popup-sub-title {
|
|
margin: 5px 0 0 0;
|
|
padding: 0;
|
|
font-weight: normal;
|
|
font-size: 11px;
|
|
}
|
|
.popup-body {
|
|
padding: 10px;
|
|
}
|
|
|
|
.popup-buttons {
|
|
&.row {
|
|
padding: 10px 10px;
|
|
}
|
|
|
|
.button {
|
|
margin: 0px 5px;
|
|
min-height: $popup-button-min-height;
|
|
border-radius: $popup-button-border-radius;
|
|
line-height: $popup-button-line-height;
|
|
|
|
&:first-child {
|
|
margin-left: 0px;
|
|
}
|
|
&:last-child {
|
|
margin-right: 0px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.popup-open {
|
|
pointer-events: none;
|
|
|
|
&.modal-open .modal {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.popup-backdrop, .popup {
|
|
pointer-events: auto;
|
|
}
|
|
}
|