Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {Component} from '@angular/core';
import {ActionSheetController, IonicPage, NavController, NavParams} from 'ionic-angular';
@Component({
selector: 'page-rush-buy',
templateUrl: 'rush-buy.html',
})
export class RushBuyPage {
obj = {
amount: null,
food: '',
foodText: '请选择',
};
foodList;
constructor(public navCtrl: NavController, public navParams: NavParams,
private actionSheetCtrl: ActionSheetController) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad RushBuyPage');
}
chooseFood() {
const btnArr = this.foodList.map(e => {
const data = {
text: e.name,
role: e.id,
handler: () => {
// this.obj.orgId = e.id;
// this.obj.orgText = e.name;
}
};
return data;
});
btnArr.push({
text: '取消',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
});
const actionSheet = this.actionSheetCtrl.create({
cssClass: 'cameraAction',
buttons: btnArr
});
actionSheet.present();
}
//增加
add() {
if (this.obj.amount < 10) this.obj.amount ++;
}
//减少
reduce() {
if (this.obj.amount > 1) this.obj.amount --;
}
}