mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(toggle): use slot attr instead of item, add correct classes
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Apple</ion-label>
|
||||
<ion-toggle item-start></ion-toggle>
|
||||
<ion-toggle slot="start"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
@ -106,7 +106,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Apple</ion-label>
|
||||
<ion-toggle item-start></ion-toggle>
|
||||
<ion-toggle slot="start"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Apple</ion-label>
|
||||
<ion-toggle item-start></ion-toggle>
|
||||
<ion-toggle slot="start"></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
|
||||
@ -274,7 +274,7 @@ import { ItemReorder } from './item-reorder';
|
||||
@Component({
|
||||
selector: 'ion-list-header,ion-item,[ion-item],ion-item-divider',
|
||||
template:
|
||||
'<ng-content select="[item-start],[item-left],ion-checkbox:not([item-end]):not([item-right])"></ng-content>' +
|
||||
'<ng-content select="[slot=\'start\'],[item-start],[item-left],ion-checkbox:not([slot=\'end\']):not([item-end]):not([item-right])"></ng-content>' +
|
||||
'<div class="item-inner">' +
|
||||
'<div class="input-wrapper">' +
|
||||
'<ng-content select="ion-label"></ng-content>' +
|
||||
@ -283,7 +283,7 @@ import { ItemReorder } from './item-reorder';
|
||||
'</ion-label>' +
|
||||
'<ng-content select="ion-select,ion-input,ion-textarea,ion-datetime,ion-range,[item-content]"></ng-content>' +
|
||||
'</div>' +
|
||||
'<ng-content select="[item-end],[item-right],ion-radio,ion-toggle"></ng-content>' +
|
||||
'<ng-content select="[slot=\'end\'],[item-end],[item-right],ion-radio,ion-toggle"></ng-content>' +
|
||||
'<ion-reorder *ngIf="_hasReorder"></ion-reorder>' +
|
||||
'</div>' +
|
||||
'<div class="button-effect"></div>',
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Toggle (left)</ion-label>
|
||||
<ion-toggle [(ngModel)]="toggle" item-start [disabled]='disabled'></ion-toggle>
|
||||
<ion-toggle [(ngModel)]="toggle" slot="start" [disabled]='disabled'></ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
|
||||
@ -17,6 +17,9 @@ ion-toggle.upgraded {
|
||||
ion-toggle ion-gesture {
|
||||
display: block;
|
||||
visibility: inherit;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.toggle-cover {
|
||||
|
||||
@ -105,13 +105,13 @@ export class Toggle implements BooleanInputComponent {
|
||||
|
||||
|
||||
render() {
|
||||
return h(this,
|
||||
h('ion-gesture', Ionic.theme(this, 'toggle', {
|
||||
class: {
|
||||
'toggle-activated': this.activated,
|
||||
'toggle-checked': this.checked,
|
||||
'toggle-disabled': this.disabled,
|
||||
},
|
||||
return h(this, Ionic.theme(this, 'toggle', {
|
||||
class: {
|
||||
'toggle-activated': this.activated,
|
||||
'toggle-checked': this.checked,
|
||||
'toggle-disabled': this.disabled,
|
||||
},
|
||||
}), h('ion-gesture', {
|
||||
props: {
|
||||
'canStart': this.canStart.bind(this),
|
||||
'onStart': this.onDragStart.bind(this),
|
||||
@ -125,7 +125,7 @@ export class Toggle implements BooleanInputComponent {
|
||||
'threshold': 20,
|
||||
'attachTo': 'parent'
|
||||
}
|
||||
}),
|
||||
},
|
||||
[
|
||||
h('div.toggle-icon',
|
||||
h('div.toggle-inner')
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<ion-item *virtualItem="let item" [ngClass]="item.class">
|
||||
<ion-label>{{item.type}}-{{item.value}}</ion-label>
|
||||
<ion-checkbox *ngIf="item.type === 'checkbox'" item-start></ion-checkbox>
|
||||
<ion-toggle *ngIf="item.type === 'toggle'" item-start></ion-toggle>
|
||||
<ion-toggle *ngIf="item.type === 'toggle'" slot="start"></ion-toggle>
|
||||
<ion-radio *ngIf="item.type === 'radio'" item-start></ion-radio>
|
||||
<ion-range *ngIf="item.type === 'range'"></ion-range>
|
||||
</ion-item>
|
||||
|
||||
Reference in New Issue
Block a user