zoukankan      html  css  js  c++  java
  • 关于ionic的一些坑(1)

    既然来了,总要留下点什么证明自己来过不是,今天就扒一扒自己在ionic上面遇到的坑,因为在项目中2还没出来,所以现在所遇到的都是1中的,关于2的,待老夫以后详细摸索之后在与君细细道来。

    1、ionic的创建和编写

      这一点想必大家都不需要了吧,因为网上有很多帖子,很多资料都有,所以我也就不说了哈

    2、爬坑ing。。。

      因为自己也是刚出道的菜鸟,对于一些细节的把握还不够,所以我把自己认为是坑的跟大家分享一下,大神看到了,笑笑就好,别拍砖。。。

         关于ionic在安卓机上面物理返回键到首页面的时候,点击返回退出APP的功能

      在你的app.js里面的.run()方法里,有一个

    $ionicPlatform.ready(function() {})
    的准备方法,在这里面写入
     $ionicPlatform.registerBackButtonAction(function (e) {
    e.preventDefault();
    function showConfirm() {
    var confirmPopup = $ionicPopup.confirm({
    template: '您确定要退出应用吗?',
    buttons: [
    { text: '取消',
    type: 'button-positive button-outline'
    },
    {
    text: '确定',
    type: 'button-positive button-outline',
    onTap: function(){
    ionic.Platform.exitApp();
    }
    },
    ]
    });

    confirmPopup.then(function (res) {
    if (res) {
    ionic.Platform.exitApp();
    } else {

    }
    });
    }
    if ($location.path() == '/tab2/myindex' ) { //这是你首页的路由名字
    showConfirm();
    }
    else if ($ionicHistory.backView() ) {
    $ionicHistory.goBack();
    } else {
    showConfirm();
    }
    return false;
    }, 101);
    就可以了,君可一试

    今天第一次来博客园上班,暂且先到此为止吧,希望大家多多支持,fighting!!
  • 相关阅读:
    navicat连接虚拟机中mysql"Access denied for user'root'@'IP地址'"问题
    Centos6.4 + mysql-5.6.38-linux-glibc2.12-x86_64.tar 实现mysql主从复制
    三、mock测试技术
    二、数据加密
    一.unittest框架初识
    3.Allure报告
    2.pytest参数化
    1.pytest框架初识
    RabbitMQ 几种工作模式---(三) Publish/Subscribe
    RabbitMQ 几种工作模式---(二)work
  • 原文地址:https://www.cnblogs.com/zyl521531/p/6184387.html
Copyright © 2011-2022 走看看