0
我正在關注試圖創建工作表的doc。不知道爲什麼在dismiss()
和Cannot find name someAsyncOperation
上獲得someAsyncOperation()
的錯誤消息Property 'dismiss' does not exist on type 'ActionSheetController'
。離子2 - 屬性'dismiss'不存在類型'ActionSheetController'
我錯過了什麼嗎?
import { ActionSheetController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ModalController, ViewController } from 'ionic-angular';
constructor(
public viewCtrl: ViewController,
public navCtrl: NavController,
public actionSheetCtrl: ActionSheetController,
public modalCtrl: ModalController,
public navParams: NavParams,
) {}
openActSheet(){
let actionSheet = this.actionSheetCtrl.create({
title:"Type",
buttons:[
{
text: 'Hour',
handler:() => {
let navTransition = this.actionSheetCtrl.dismiss();
someAsyncOperation().then(() => {
console.log("text");
})
navTransition.then(() => {
this.navCtrl.pop();
});
}
},
{
text: 'Day',
handler: function(){
console.log("Day Clicked");
}
},
{
text: 'Week',
handler: function(){
console.log("Week Clicked");
}
},
{
text: 'Month',
handler: function(){
console.log("Month Clicked");
}
}
]
});
actionSheet.present();
}
哪裏定義someAsyncOperation? –
嗨,我沒有定義它。在使用它之前是否需要定義該功能?對不起,第一次使用ActionSheet不熟悉它。 – aaa
這是一個自定義JavaScript函數..你需要定義需要發生什麼動作。該文檔只是一個示例演示.. –