Ionic应用程序在chrome和设备方面落后了很多
Ionic app lags a lot on chrome and device
所以我最近开始使用ionic框架,当我第一次尝试制作一个android应用程序并在chrome中运行时,它既快又快。然后我添加了一个按钮,可以将你带到另一个屏幕,这个屏幕上都有导航栏、侧菜单和自定义字体,之后我的应用程序变得非常慢!现在我甚至无法点击按钮进入下一个屏幕。该应用程序甚至不进行服务器调用。它在firefox中运行得相当快,但如果我使用离子服务——实验室,应用程序仍然落后。此外,我添加了自定义字体,当我在实际的android设备上加载时,当我第一次启动应用程序时会显示这些字体,但在第二次启动时再也不会显示。我附上了两个屏幕的代码。
`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- your app's js -->
</head>
<body ng-app="starter">
<ion-pane class="customBackground">
<div class="harpee" style="font-family: Freehand521, sans-serif">Harpee</div>
<div class="motto">
<p>A Culture of Happiness and Hope</p>
</div>
<div class="logIn">
<h1>Log In</h1>
</div>
<div class="logInForm">
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="Username">
</label>
</div>
<div class="list list-inset formSpacing">
<label class="item item-input">
<input type="password" placeholder="Password">
</label>
</div>
<a href="homeView.html">
<button class="button button-positive customButton">
Sign In
</button>
</a>
<div class="customText">
<p>Forgot your Password?</p>
<p>Sign Up</p>
</div>
</div>
</ion-pane>
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="js/app.js"></script>
</body>
</html>`
`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/home.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- your app's js -->
<!--Fonts-->
</head>
<body ng-app="starter">
<ion-pane>
<ion-side-menus>
<ion-side-menu-content>
<ion-nav-bar class="bar bar-header bar-positive">
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<i class="icon ion-ios7-search button button-clear" ng-click="#"></i>
</ion-nav-buttons>
</ion-nav-bar>
<ion-tabs class="tabs-positive">
<ion-tab icon="ion-home" ui-sref="home">
<ion-nav-view name="home"></ion-nav-view>
</ion-tab>
<ion-tab icon="ion-compose" ui-sref="talk">
<ion-nav-view name="talk"></ion-nav-view>
</ion-tab>
<ion-tab icon="ion-social-reddit" ui-sref="hdi">
<ion-nav-view name="hdi"></ion-nav-view>
</ion-tab>
<ion-tab icon="ion-person" ui-sref="you">
<ion-nav-view name="you"></ion-nav-view>
</ion-tab>
</ion-tabs>
</ion-side-menu-content>
<ion-side-menu side="left">
<header class="bar bar-header bar-stable">
<h1 class="title">Menu</h1>
</header>
<ion-content class="has-header">
<ion-list>
<ion-item class="item item-avatar">
<img src="img/3.jpg">
<h2>User Name</h2>
<p>Brief Bio</p>
<!--This is the actual code to be used, to fetch user data and display as in the above code-->
<!--<img ng-src="{{item.img}}">-->
<!--<h2>{{item.title}}</h2>-->
<!--<p>{{item.description}}</p>-->
</ion-item>
<ion-item nav-clear menu-close ng-click="#">
<i class="icon ion-person" ng-click="#">
My Profile
</i>
</ion-item>
<ion-item nav-clear menu-close ng-click="#">
<i class="icon ion-person-stalker" ng-click="#">
Forums
</i>
<span class="badge badge-assertive">0</span>
</ion-item>
<ion-item nav-clear menu-close ng-click="#">
<i class="icon ion-loop" ng-click="#">
Connect
</i>
</ion-item>
<ion-item nav-clear menu-close ng-click="#">
<i class="icon ion-gear-a" ng-click="#">
Settings
</i>
</ion-item>
<ion-item nav-clear menu-close ng-click="#">
<i class="icon ion-power" ng-click="#">
Log Out
</i>
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
</ion-pane>
<script type="text/ng-template" id="home.html">
<ion-view title="Home">
<ion-content padding="true">
<div class="list card">
<div class="item item-avatar">
<img src="img/3.jpg">
<h2>Raphael Rigwanzo</h2>
<p>January 30, 2015</p>
</div>
<div class="item item-body">
<img class="full-image" src="img/3.jpg">
<p>
Exciting bootcamp happening in school. Alot of interesting lads here!!
</p>
<p>
<a href="#" class="subdued">1 Like</a>
<a href="#" class="subdued">5 Comments</a>
</p>
</div>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item" href="#">
<i class="icon ion-thumbsup"></i>
Like
</a>
<a class="tab-item" href="#">
<i class="icon ion-chatbox"></i>
Comment
</a>
<a class="tab-item" href="#">
<i class="icon ion-share"></i>
Share
</a>
</div>
</div>
</ion-content>
</ion-view>
</script>
<script type="text/ng-template" id="talk.html">
<ion-view title="Talk">
<ion-content padding="true">
<div class="list card">
<div class="item item-avatar">
<img src="img/3.jpg">
<h2>Raphael Rigwanzo</h2>
<p>Developer</p>
</div>
<div class="item item-body">
<input type="text" placeholder="What's on your mind...">
</div>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item" href="#">
<i class="icon ion-android-camera"></i>
Upload Photo
</a>
<a class="tab-item" href="#">
<i class="icon ion-ios7-location"></i>
Tag location
</a>
</div>
</div>
<button class="button button-block button-positive">
Post
</button>
</ion-content>
</ion-view>
</script>
<script type="text/ng-template" id="hdi.html">
<ion-view title="HDI">
<ion-content padding="true">
<div class="list card">
<div style="text-align: center;">
<h2>Harpee</h2>
<p>HDI Mascot</p>
</div>
<div class="item item-body" style="text-align: center;">
<img src="#">
</div>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item" href="#">
<i class="icon ion-clipboard"></i>
Know Your HDI
</a>
</div>
</div>
</ion-content>
</ion-view>
</script>
<script type="text/ng-template" id="you.html">
<ion-view title="Profile">
<ion-content>
<div class="userStatsBackground">
<div class="profile">
<img class="profilePicture circle" src="img/3.jpg">
<h1>Raphael Rigwanzo</h1>
<p>Developer</p>
</div>
<div class="userStatsFill">
<div class="row userStats">
<div class="col">Talks</div>
<div class="col">Followers</div>
<div class="col">Following</div>
</div>
<div class="row userStats">
<div class="col"><h3>300</h3></div>
<div class="col"><h3>1200</h3></div>
<div class="col"><h3>300</h3></div>
</div>
</div>
</div>
</ion-content>
</ion-view>
</script>
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<script src="js/app.js"></script>
</body>
</html>`
在加载js
和css
文件时,应该只使用一个index.html
,而不是在每个页面中。此外,对于id="home.html"
这样的文件,您有一个奇怪的参考。所以,我假设你通过引用id来获得带有锚的页面。这不是ionic的工作方式。您应该使用角度控制器来导航和渲染视图。至于你的字体,你是如何加载的?它们在Chrome、Firefox上加载了吗?这些链接可能对此有所帮助。
https://blog.nraboy.com/2014/10/use-font-awesome-glyph-icons-ionicframework/http://forum.ionicframework.com/t/custom-font-usage/4270/9
相关文章:
- Canvas Html5绘图应用程序,移动画布会导致重大问题
- Emberjs应用程序加载在除Index之外的所有路由上
- 使用电话间隙在Android应用程序中显示SQL Lite的数据
- 在AngularJS应用程序中使用封装指令和路由的推荐方式是什么
- Windows8应用程序(html&Javascript):从图片库(除了文件选择器)显示图像的另一种方式
- angular 1.5应用程序中的导航栏
- 在Web应用程序中使用Highcharts javascript
- angularjs+rails应用程序中未显示模板
- 使用acess代币登录Facebook,并通过网络应用程序离线发布
- 从HTTPGET返回一个自定义对象列表,以便在Angular 2应用程序中使用
- 科尔多瓦页面类应用程序中的多个谷歌地图
- 使用谷歌应用程序脚本将服务器端数据表返回到客户端
- Angularjs-utils高亮过滤器在搜索时破坏应用程序
- 在phonegap应用程序内部重定向不起作用
- 使用谷歌应用程序脚本从工作表中获取值并将其显示在文本框中
- MockJax没有在JavaScript应用程序中发送对我AJAX请求的响应
- Ionic应用程序在chrome和设备方面落后了很多
- Git:如何在目录结构方面分离后端Rest Api和前端应用程序的版本控制
- 简单的AJAX web应用程序示例,包括客户端和服务器方面
- Phonegap/Cordova-在哪里cdvfile://localhost在应用程序根目录方面