mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
89 lines
1.9 KiB
TypeScript
89 lines
1.9 KiB
TypeScript
import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
|
import { ionicBootstrap, ItemSliding, NavController, Toast, reorderArray } from 'ionic-angular';
|
|
|
|
@Component({
|
|
templateUrl: 'main.html',
|
|
encapsulation: ViewEncapsulation.None
|
|
})
|
|
class ApiDemoPage {
|
|
chats: any[];
|
|
editButton: string = 'Reorder';
|
|
editing: boolean = false;
|
|
|
|
constructor(private nav: NavController) {
|
|
this.chats = [
|
|
{
|
|
img: './avatar-cher.png',
|
|
name: 'Cher',
|
|
message: 'Ugh. As if.',
|
|
time: '9:38 pm'
|
|
}, {
|
|
img: './avatar-dionne.png',
|
|
name: 'Dionne',
|
|
message: 'Mr. Hall was way harsh.',
|
|
time: '8:59 pm'
|
|
}, {
|
|
img: './avatar-murray.png',
|
|
name: 'Murray',
|
|
message: 'Excuse me, "Ms. Dione."',
|
|
time: 'Wed'
|
|
},
|
|
{
|
|
img: './avatar-cher.png',
|
|
name: 'Cher',
|
|
message: 'Ugh. As if.',
|
|
time: '9:38 pm'
|
|
}, {
|
|
img: './avatar-dionne.png',
|
|
name: 'Dionne',
|
|
message: 'Mr. Hall was way harsh.',
|
|
time: '8:59 pm'
|
|
}, {
|
|
img: './avatar-murray.png',
|
|
name: 'Murray',
|
|
message: 'Excuse me, "Ms. Dione."',
|
|
time: 'Wed'
|
|
},
|
|
{
|
|
img: './avatar-cher.png',
|
|
name: 'Cher',
|
|
message: 'Ugh. As if.',
|
|
time: '9:38 pm'
|
|
}, {
|
|
img: './avatar-dionne.png',
|
|
name: 'Dionne',
|
|
message: 'Mr. Hall was way harsh.',
|
|
time: '8:59 pm'
|
|
}, {
|
|
img: './avatar-murray.png',
|
|
name: 'Murray',
|
|
message: 'Excuse me, "Ms. Dione."',
|
|
time: 'Wed'
|
|
}];
|
|
}
|
|
|
|
toggleEdit() {
|
|
this.editing = !this.editing;
|
|
if (this.editing) {
|
|
this.editButton = 'Done';
|
|
} else {
|
|
this.editButton = 'Reorder';
|
|
}
|
|
}
|
|
|
|
reorderData(indices: any) {
|
|
this.chats = reorderArray(this.chats, indices);
|
|
}
|
|
}
|
|
|
|
|
|
@Component({
|
|
template: '<ion-nav [root]="root"></ion-nav>'
|
|
})
|
|
class ApiDemoApp {
|
|
root = ApiDemoPage;
|
|
}
|
|
|
|
ionicBootstrap(ApiDemoApp);
|