zoukankan      html  css  js  c++  java
  • Ionic开发中常见问题和解决方案记录

    1npm按装包失败

    更换源:npm config set registry https://registry.npm.taobao.org

    或者使用cnpm

    sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

     

    2.ionic真机调试

    ionic run android --livereload -c -s

    3.ionic run ios 报错

    sudo npm install -g ios-deploy --unsafe-perm=true

    4.跨域(这个问题在android上有,请求发不出去)

    cordova plugin add cordova-plugin-whitelist

    5.google跨域插件:

    Access-Control-Allow-Origin

    6.更改statusbar颜色

    cordova plugin add cordova-plugin-statusbar

    7.ionic生成图标资源

    准备好icon.png 和splash.png

    ionic resources

    8.解决android tabs的布局调到底部,和iOS一致

    $ionicConfigProvider.tabs.position('bottom');

    9.android录制屏幕:

    adb shell screenrecord /sdcard/video/littleQ.mp4 命令录制

    问题:

    Using this version of Cordova with older version of cordova-android is being deprecated. Consider upgrading to cordova-android@5.0.0 ro newer

    删除platforms对应的平台,重新platform add [platform]

    ionic build android : Unable to start the daemon process error 

    在用户文件夹中找到.gradle文件夹,新增gradle.properties文件,内容如下:

    org.gradle.jvmargs=-Xmx512m 

      

    ionic跨域问题,在接口端加上:

     response.setHeader("Access-Control-Allow-Origin", "*");  
     response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");    
     
    问题:ion-scroll 在 ion-content 里不能上下滑动 的解决方案:
            $timeout(function () {
                //return false; // <--- comment this to "fix" the problem
                var sv = $ionicScrollDelegate.$getByHandle('horizontalScroll').getScrollView();
    
                var container = sv.__container;
    
                var originaltouchStart = sv.touchStart;
                var originalmouseDown = sv.mouseDown;
                var originaltouchMove = sv.touchMove;
                var originalmouseMove = sv.mouseMove;
    
                container.removeEventListener('touchstart', sv.touchStart);
                container.removeEventListener('mousedown', sv.mouseDown);
                document.removeEventListener('touchmove', sv.touchMove);
                document.removeEventListener('mousemove', sv.mousemove);
    
                sv.touchStart = function (e) {
                    e.preventDefault = function () { }
                    if (originalmouseMove) {
                        originaltouchStart.apply(sv, [e]);
                    }
                }
    
                sv.touchMove = function (e) {
                    e.preventDefault = function () { }
                    if (originalmouseMove) {
                        originaltouchMove.apply(sv, [e]);
                    }
                }
    
                sv.mouseDown = function (e) {
                    e.preventDefault = function () { }
                    if (originalmouseMove) {
                        originalmouseDown.apply(sv, [e]);
                    }
                }
    
                sv.mouseMove = function (e) {
                    e.preventDefault = function () { }
                    if (originalmouseMove) {
                        originalmouseMove.apply(sv, [e]);
                    }
                }
    
                container.addEventListener("touchstart", sv.touchStart, false);
                container.addEventListener("mousedown", sv.mouseDown, false);
                document.addEventListener("touchmove", sv.touchMove, false);
                document.addEventListener("mousemove", sv.mouseMove, false);
            });
    View Code
  • 相关阅读:
    九度OJ 1035:找出直系亲属 (二叉树、递归)
    九度OJ 1034:寻找大富翁 (排序)
    九度OJ 1033:继续xxx定律 (基础题)
    九度OJ 1032:ZOJ (基础题)
    centos 6.4 安装mongodb
    数据校验工具类
    《 mongodb 学习 》java 基本操作
    《 mongodb 学习 》基本操作2
    《 mongodb 学习 》之基本操作
    《 mongodb 学习 》之安装篇
  • 原文地址:https://www.cnblogs.com/tonge/p/5595386.html
Copyright © 2011-2022 走看看