离子显示和模态 - 即使在快速手机上也会变慢

时间:2016-09-23 13:45:19

标签: javascript android ionic-framework

我已经编辑了离子的启动器模板,一切都在-lab环境中运行良好。但是,当我在实际手机上运行应用程序时,可用性会因速度和性能而降低。

<script id="templates/landingModalRegister.html" type="text/ng-template">
            <ion-modal-view class="">
                <ion-header-bar class="bar bar-header bar-dark">
                  <button class="button button-clear button-primary" ng-click="showRegister.hide()">Cancel</button>
                </ion-header-bar>
                <ion-content class="registerModal" scroll="false">

                    <form ng-submit="register()" style="margin-top: 150px">
                        <label class="item item-input landingInput">
                            <span class="input-label">Username</span>
                            <input type="text" ng-model="registerData.username">
                        </label>
                        <label class="item item-input landingInput">
                            <span class="input-label">Password</span>
                            <input type="password" ng-model="registerData.password">
                        </label>
                        <label class="item item-input landingInput">
                            <span class="input-label">Retype password</span>
                            <input type="password" ng-model="registerData.password2">
                        </label>
                        <label class="item item-input item-select landingInput">
                            <div class="input-label">
                                Account Type
                            </div>
                            <select ng-model="registerData.type">
                                <option>Client</option>
                                <option selected>Admin</option>
                            </select>
                        </label>
                        <label class="item landingInput">
                            <button class="button button-block button-balanced" type="submit">Register</button>
                        </label>
                    </form>
                </ion-content>
            </ion-modal-view>

以onclick函数发起的这种模态视图为例。此模式不会在较旧的手机(Samsung Avant)上打开,而在较新的手机(Nexus 6p)上会打开,但会缓慢而不平滑。我使用设备检查器来检查错误,没有任何明显的信息,并且存在类似设备的不稳定行为 - 这在实验室环境中很顺利。

我的另一个问题是如何正确优化图片 - 当使用更高分辨率的图像(我将它们缩放到设备尺寸)时,背景仍然可以在页面上显示。

为了让这更接近原生表现,我有什么遗漏?

编辑:这是我实现模态的代码。

$ionicModal.fromTemplateUrl('templates/landingModalRegister.html', {
    scope: $scope,
    animation: 'slide-in-up'
}).then(function(modal) {
    $scope.showRegister = modal;
});

$scope.openRegister = function () {
    $scope.showRegister.show();
}

1 个答案:

答案 0 :(得分:0)

可能你使用了很多css渐变,盒子阴影等等吗?

尝试删除所有自定义css以查看此延迟是否消失。

其他提示: