上拉菜单html,ionic上拉菜单解析(学习笔记)

Title

Action Sheet

angular.module('starter',['ionic'])

.run(function ($ionicPlatform) {

$ionicPlatform.ready(function () {

if(window.cordova && window.cordova.plugins.Keyboard){

cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

}

if(window.StartusBar){

StatusBar.styleDefault();

}

});

})

.controller('actionsheetCtl',['$scope','$ionicActionSheet','$timeout',function ($scope,$ionicActionSheet,$timeout) {

$scope.show=function () {

var hideSheet=$ionicActionSheet.show({

buttons:[

{text:'Share This'},

{text:'Move'}

],

destructiveText:'Delete', //destructive破坏性的 样式:文字颜色为红色

titleText:'Modify your album', ///将会位于上拉菜单的头部位置

cancelText:'Cancel',//位于上拉菜单的尾部,且与主体之间存在间隙

cancel:function () {

//add cancel code

//这里是上拉菜单收回会将要执行的代码

},

buttonClicked:function (index) {

alert('你点击了第'+index+'个按钮')

//index下标从0开始

//这里的代码是点击button后将要执行的代码,button为上面定义的数组

return true;

}

});

$timeout(function () {

alert('再见')

//这里为设置的显示时长

hideSheet();

},2000);

};

}])

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Angular2移动端中实现上拉加载和下拉刷新的方式有许多种。下面我将介绍一种常用的实现方法。 1. 首先,我们需要引入一些必要的库和组件。我们可以使用Ionic框架中提供的IonRefresher和InfiniteScroll组件来实现下拉刷新和上拉加载的效果。需要确保已经安装了Ionic框架并引入了相关的模块。 2. 在需要实现上拉加载的页面或组件中,添加一个IonRefresher组件,并绑定事件。例如: ```html <ion-content> <ion-refresher (ionRefresh)="doRefresh($event)"> <ion-refresher-content></ion-refresher-content> </ion-refresher> <!--其他内容--> </ion-content> ``` 在组件中,定义一个doRefresh方法来处理刷新的逻辑。例如: ```typescript import { Component } from '@angular/core'; @Component({ selector: 'your-component', templateUrl: 'your-component.html', styleUrls: ['your-component.css'] }) export class YourComponent { doRefresh(event) { // 执行刷新逻辑 // 更新数据 // 结束刷新动作 event.complete(); } } ``` 3. 接下来,我们来实现上拉加载的效果。在页面或组件中添加一个InfiniteScroll组件,并绑定事件。例如: ```html <ion-content (ionInfinite)="loadMore($event)"> <!--其他内容--> <ion-infinite-scroll> <ion-infinite-scroll-content></ion-infinite-scroll-content> </ion-infinite-scroll> </ion-content> ``` 在组件中,定义一个loadMore方法来处理加载更多的逻辑。例如: ```typescript import { Component } from '@angular/core'; @Component({ selector: 'your-component', templateUrl: 'your-component.html', styleUrls: ['your-component.css'] }) export class YourComponent { loadMore(event) { // 执行加载更多逻辑 // 加载更多数据 // 结束加载更多动作 event.complete(); } } ``` 以上就是使用Ionic框架中的IonRefresher和InfiniteScroll组件来实现Angular2移动端上拉加载和下拉刷新的步骤。需注意在具体的业务逻辑中,需要结合实际情况进行相应的处理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值