ionic-----下拉 三布局可点选

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
        <link rel="stylesheet" href="css/ionic.css" />
        <script type="text/javascript" src="js/ionic.bundle.min.js" ></script>
        <script type="text/javascript">
            angular.module('ionicApp', ['ionic'])
                .controller('RootCtrl', function($scope) {
                    $scope.onControllerChanged = function(oldController, oldIndex, newController, newIndex) {
                        console.log('Controller changed', oldController, oldIndex, newController, newIndex);
                        console.log(arguments);
                    };
                })
                .controller('HomeCtrl', function($scope, $timeout, $ionicModal, $ionicActionSheet,$http) {
                    $scope.items = [];
                    
                    $scope.bookss = ["C语言","B语言","D语言"];
                
                    $scope.refreshBooks = function(){
                        $http({
                            method:"get",
                            url:"books.json"
                        }).then(function success(response){
                            $scope.bookss = response.data;
                            
                        },function error(response){
                            
                        }).finally(function(){
                            $scope.$broadcast("scroll.refreshComplete");
                        });
                    }
                    
                    

                    $ionicModal.fromTemplateUrl('newTask.html', function(modal) {
                        $scope.settingsModal = modal;
                    });

                    var removeItem = function(item, button) {
                        $ionicActionSheet.show({
                            buttons: [],
                            destructiveText: 'Delete Task',
                            cancelText: 'Cancel',
                            cancel: function() {
                                return true;
                            },
                            destructiveButtonClicked: function() {
                                $scope.items.splice($scope.items.indexOf(item), 1);
                                return true;
                            }
                        });
                    };

                    var completeItem = function(item, button) {
                        item.isCompleted = true;
                    };

                    $scope.onReorder = function(el, start, end) {
                        ionic.Utils.arrayMove($scope.items, start, end);
                    };

                    $scope.onRefresh = function() {
                        console.log('ON REFRESH');

                        $timeout(function() {
                            $scope.$broadcast('scroll.refreshComplete');
                        }, 1000);
                    }

                    $scope.removeItem = function(item) {
                        removeItem(item);
                    };

                    $scope.newTask = function() {
                        $scope.settingsModal.show();
                    };

                    // Create the items
                    for(var i = 0; i < 25; i++) {
                        $scope.items.push({
                            title: 'Task ' + (i + 1),
                            buttons: [{
                                text: 'Done',
                                type: 'button-success',
                                onButtonClicked: completeItem,
                            }, {
                                text: 'Delete',
                                type: 'button-danger',
                                onButtonClicked: removeItem,
                            }]
                        });
                    }

                })

                .controller('TaskCtrl', function($scope) {
                    $scope.close = function() {
                        $scope.modal.hide();
                    }
                });
        </script>
    </head>

    <body ng-app="ionicApp" ng-controller="RootCtrl">

        <ion-tabs class="tabs-icon-only tabs-positive">

            <ion-tab title="Home" icon-on="ion-ios-filing" icon-off="ion-ios-filing-outline" ng-controller="HomeCtrl">
                <ion-header-bar class="bar-positive">
                    <button class="button button-clear" ng-click="newTask()">New</button>
                    <h1 class="title">Tasks1</h1>
                </ion-header-bar>
                <ion-content >
                    
                    <ion-refresher pulling-text="下拉刷新....." on-refresh="refreshBooks();"></ion-refresher>
                    <ion-list>
                        <ion-item ng-repeat="book in bookss track by $index">
                            {{book}}
                        </ion-item>
                    </ion-list>
                    
                    <!--<ion-refresher></ion-refresher>
                    <ion-list scroll="false" on-refresh="onRefresh()" s-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled">
                        <ion-item ng-repeat="item in items" item="item" buttons="item.buttons" can-delete="true" can-swipe="true" on-delete="deleteItem(item)" ng-class="{completed: item.isCompleted}">
                            {{item.title}}
                            <i class="{{item.icon}}"></i>
                        </ion-item>
                    </ion-list>-->
                </ion-content>
            </ion-tab>

            <ion-tab title="About" icon-on="ion-ios-clock" icon-off="ion-ios-clock-outline">
                <ion-header-bar class="bar-positive">
                    <button class="button button-clear" ng-click="newTask()">New</button>
                    <h1 class="title">Tasks2</h1>
                </ion-header-bar>
                <ion-content has-tabs="true" on-refresh="onRefresh()">
                    这是第二个页面
                </ion-content>
            </ion-tab>

            <ion-tab title="Settings" icon-on="ion-ios-gear" icon-off="ion-ios-gear-outline">
                <ion-header-bar class="bar-positive">
                    <button class="button button-clear" ng-click="newTask()">New</button>
                    <h1 class="title">Tasks3</h1>
                </ion-header-bar>
                <ion-content has-tabs="true" on-refresh="onRefresh()">
                    页面3
                </ion-content>
            </ion-tab>

        </ion-tabs>
    </body>

</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值