mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
@ -1,8 +1,7 @@
|
||||
ion-hide-when.show-content {
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
ion-hide-when.hide-content {
|
||||
/* stylelint-disable-next-line declaration-no-important */
|
||||
display: none !important;
|
||||
:host(.hide-content) {
|
||||
display: none;
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ import { DisplayWhen, getTestResult } from '../../utils/show-hide-when-utils';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-hide-when',
|
||||
styleUrl: './hide-when.scss'
|
||||
styleUrl: './hide-when.scss',
|
||||
shadow: true
|
||||
})
|
||||
export class HideWhen implements ComponentInterface, DisplayWhen {
|
||||
|
||||
@ -61,9 +62,12 @@ export class HideWhen implements ComponentInterface, DisplayWhen {
|
||||
hostData() {
|
||||
return {
|
||||
class: {
|
||||
'show-content': !this.passesTest,
|
||||
'hide-content': this.passesTest
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return <slot></slot>;
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,15 @@
|
||||
<ion-content padding>
|
||||
|
||||
<h2>Mode Tests</h2>
|
||||
<ion-hide-when mode="md, ios">
|
||||
<ion-hide-when modes="md, ios">
|
||||
<div>Hides on MD, iOS</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="md">
|
||||
<ion-hide-when modes="md">
|
||||
<div>Hides on MD only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="ios">
|
||||
<ion-hide-when modes="ios">
|
||||
<div>Hides on iOS only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
|
@ -21,15 +21,15 @@
|
||||
<ion-content padding fullscreen>
|
||||
|
||||
<h2>Mode Tests</h2>
|
||||
<ion-hide-when mode="md, ios">
|
||||
<ion-hide-when modes="md, ios">
|
||||
<div>Hides on MD, iOS</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="md">
|
||||
<ion-hide-when modes="md">
|
||||
<div>Hides on MD only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="ios">
|
||||
<ion-hide-when modes="ios">
|
||||
<div>Hides on iOS only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
|
@ -2,15 +2,15 @@
|
||||
<ion-content padding>
|
||||
|
||||
<h2>Mode Tests</h2>
|
||||
<ion-hide-when mode="md, ios">
|
||||
<ion-hide-when modes="md, ios">
|
||||
<div>Hides on MD, iOS</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="md">
|
||||
<ion-hide-when modes="md">
|
||||
<div>Hides on MD only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
<ion-hide-when mode="ios">
|
||||
<ion-hide-when modes="ios">
|
||||
<div>Hides on iOS only</div>
|
||||
</ion-hide-when>
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
ion-show-when.show-content {
|
||||
display: block;
|
||||
:host {
|
||||
display: none;
|
||||
}
|
||||
|
||||
ion-show-when.hide-content {
|
||||
/* stylelint-disable-next-line declaration-no-important */
|
||||
display: none !important;
|
||||
:host(.show-content) {
|
||||
display: block;
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ import { DisplayWhen, getTestResult } from '../../utils/show-hide-when-utils';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-show-when',
|
||||
styleUrl: 'show-when.scss'
|
||||
styleUrl: 'show-when.scss',
|
||||
shadow: true
|
||||
})
|
||||
export class ShowWhen implements ComponentInterface, DisplayWhen {
|
||||
|
||||
@ -63,9 +64,11 @@ export class ShowWhen implements ComponentInterface, DisplayWhen {
|
||||
return {
|
||||
class: {
|
||||
'show-content': this.passesTest,
|
||||
'hide-content': !this.passesTest
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return <slot></slot>;
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,15 @@
|
||||
<ion-content padding>
|
||||
|
||||
<h2>Mode Tests</h2>
|
||||
<ion-show-when mode="md, ios">
|
||||
<ion-show-when modes="md, ios">
|
||||
<div>Shows on MD, iOS</div>
|
||||
</ion-show-when>
|
||||
|
||||
<ion-show-when mode="md">
|
||||
<ion-show-when modes="md">
|
||||
<div>Shows on MD only</div>
|
||||
</ion-show-when>
|
||||
|
||||
<ion-show-when mode="ios">
|
||||
<ion-show-when modes="ios">
|
||||
<div>Shows on iOS only</div>
|
||||
</ion-show-when>
|
||||
|
||||
|
@ -21,15 +21,15 @@
|
||||
<ion-content padding fullscreen>
|
||||
|
||||
<h2>Mode Tests</h2>
|
||||
<ion-show-when mode="md, ios">
|
||||
<ion-show-when modes="md, ios">
|
||||
<div>Shows on MD, iOS</div>
|
||||
</ion-show-when>
|
||||
|
||||
<ion-show-when mode="md">
|
||||
<ion-show-when modes="md">
|
||||
<div>Shows on MD only</div>
|
||||
</ion-show-when>
|
||||
|
||||
<ion-show-when mode="ios">
|
||||
<ion-show-when modes="ios">
|
||||
<div>Shows on iOS only</div>
|
||||
</ion-show-when>
|
||||
|
||||
|
Reference in New Issue
Block a user