mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
docs(backdrop): update docs and add usage
This commit is contained in:
21
core/src/components.d.ts
vendored
21
core/src/components.d.ts
vendored
@ -647,8 +647,17 @@ declare global {
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLIonBackdropElement extends HTMLStencilElement {
|
interface HTMLIonBackdropElement extends HTMLStencilElement {
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will stop propogation on tap. Defaults to `true`.
|
||||||
|
*/
|
||||||
'stopPropagation': boolean;
|
'stopPropagation': boolean;
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will can be clicked and will emit the `ionBackdropTap` event. Defaults to `true`.
|
||||||
|
*/
|
||||||
'tappable': boolean;
|
'tappable': boolean;
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will be visible. Defaults to `true`.
|
||||||
|
*/
|
||||||
'visible': boolean;
|
'visible': boolean;
|
||||||
}
|
}
|
||||||
var HTMLIonBackdropElement: {
|
var HTMLIonBackdropElement: {
|
||||||
@ -668,9 +677,21 @@ declare global {
|
|||||||
}
|
}
|
||||||
namespace JSXElements {
|
namespace JSXElements {
|
||||||
export interface IonBackdropAttributes extends HTMLAttributes {
|
export interface IonBackdropAttributes extends HTMLAttributes {
|
||||||
|
/**
|
||||||
|
* Emitted when the backdrop is tapped.
|
||||||
|
*/
|
||||||
'onIonBackdropTap'?: (event: CustomEvent) => void;
|
'onIonBackdropTap'?: (event: CustomEvent) => void;
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will stop propogation on tap. Defaults to `true`.
|
||||||
|
*/
|
||||||
'stopPropagation'?: boolean;
|
'stopPropagation'?: boolean;
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will can be clicked and will emit the `ionBackdropTap` event. Defaults to `true`.
|
||||||
|
*/
|
||||||
'tappable'?: boolean;
|
'tappable'?: boolean;
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will be visible. Defaults to `true`.
|
||||||
|
*/
|
||||||
'visible'?: boolean;
|
'visible'?: boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,24 @@ export class Backdrop {
|
|||||||
|
|
||||||
private lastClick = -10000;
|
private lastClick = -10000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will be visible. Defaults to `true`.
|
||||||
|
*/
|
||||||
@Prop() visible = true;
|
@Prop() visible = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will can be clicked and will emit the `ionBackdropTap` event. Defaults to `true`.
|
||||||
|
*/
|
||||||
@Prop() tappable = true;
|
@Prop() tappable = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the backdrop will stop propogation on tap. Defaults to `true`.
|
||||||
|
*/
|
||||||
@Prop() stopPropagation = true;
|
@Prop() stopPropagation = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted when the backdrop is tapped.
|
||||||
|
*/
|
||||||
@Event() ionBackdropTap: EventEmitter;
|
@Event() ionBackdropTap: EventEmitter;
|
||||||
|
|
||||||
componentDidLoad() {
|
componentDidLoad() {
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
Backdrops are full screen components that overlay other components. They are useful behind components that transition in on top of other content and can be used to dismiss that component.
|
Backdrops are full screen components that overlay other components. They are useful behind components that transition in on top of other content and can be used to dismiss that component.
|
||||||
|
|
||||||
```html
|
|
||||||
<ion-backdrop></ion-backdrop>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Auto Generated Below -->
|
<!-- Auto Generated Below -->
|
||||||
|
|
||||||
@ -16,16 +12,22 @@ Backdrops are full screen components that overlay other components. They are use
|
|||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will stop propogation on tap. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### tappable
|
#### tappable
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will can be clicked and will emit the `ionBackdropTap` event. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### visible
|
#### visible
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will be visible. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
## Attributes
|
## Attributes
|
||||||
|
|
||||||
@ -33,21 +35,29 @@ boolean
|
|||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will stop propogation on tap. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### tappable
|
#### tappable
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will can be clicked and will emit the `ionBackdropTap` event. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
#### visible
|
#### visible
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
If true, the backdrop will be visible. Defaults to `true`.
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
#### ionBackdropTap
|
#### ionBackdropTap
|
||||||
|
|
||||||
|
Emitted when the backdrop is tapped.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
31
core/src/components/backdrop/usage/angular.md
Normal file
31
core/src/components/backdrop/usage/angular.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
```html
|
||||||
|
<!-- Default backdrop -->
|
||||||
|
<ion-backdrop></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that is not tappable -->
|
||||||
|
<ion-backdrop tappable="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that is not visible -->
|
||||||
|
<ion-backdrop visible="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop with propagation -->
|
||||||
|
<ion-backdrop stopPropagation="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that sets dynamic properties -->
|
||||||
|
<ion-backdrop [tappable]="enableBackdropDismiss" [visible]="showBackdrop" [stopPropagation]="shouldPropagate"></ion-backdrop>
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'backdrop-example',
|
||||||
|
templateUrl: 'backdrop-example.html',
|
||||||
|
styleUrls: ['./backdrop-example.css'],
|
||||||
|
})
|
||||||
|
export class BackdropExample {
|
||||||
|
enableBackdropDismiss = false;
|
||||||
|
showBackdrop = false;
|
||||||
|
shouldPropagate = false;
|
||||||
|
}
|
||||||
|
```
|
23
core/src/components/backdrop/usage/javascript.md
Normal file
23
core/src/components/backdrop/usage/javascript.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
```html
|
||||||
|
<!-- Default backdrop -->
|
||||||
|
<ion-backdrop></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that is not tappable -->
|
||||||
|
<ion-backdrop tappable="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that is not visible -->
|
||||||
|
<ion-backdrop visible="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop with propagation -->
|
||||||
|
<ion-backdrop stop-propagation="false"></ion-backdrop>
|
||||||
|
|
||||||
|
<!-- Backdrop that sets dynamic properties -->
|
||||||
|
<ion-backdrop id="customBackdrop"></ion-backdrop>
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var backdrop = document.getElementById('customBackdrop');
|
||||||
|
backdrop.visible = false;
|
||||||
|
backdrop.tappable = false;
|
||||||
|
backdrop.stopPropagation = false;
|
||||||
|
```
|
Reference in New Issue
Block a user