動作選單 (Action Sheet)是個很常用到的介面,原來只要複製以下的程式碼來改就行囉!
![[Ionic] 動作選單 (Action Sheet)](https://cg2010studio.com/wp-content/uploads/2017/10/ionic-e58b95e4bd9ce981b8e596ae-action-sheet.png?w=540)
/**
Theme: Action Sheet
IDE: None
Language: AngularJS
Date: 106/10/16
Author: HappyMan
Blog: https://cg2010studio.com/
*/
var hideSheet = $ionicActionSheet.show({
buttons: [
{ text: '照相' },
{ text: '相簿' }
],
// destructiveText: 'Delete',
titleText: '請選擇',
cancelText: '取消',
cancel: function() {
console.log('cancel add');
},
buttonClicked: function(index) {
if (index == 0) {
console.log('照相');
}
if (index == 1) {
console.log('相簿');
}
return true;
}
});
記得要引用$ionicActionSheet。
參考:ionic 1- $ionicActionSheet。
隨意留個言吧:)~