我需要"好的"打开时,此页面底部的按钮位于键盘上方。 它可以在Android上运行,如左侧屏幕截图所示,但不在IOS中(右侧屏幕截图)。
你可以帮我解决这个问题吗?
此外,你可以看到"选择焦点"指令不适用于iOS ... 键盘应该是iOS上的数字键盘(手机键盘)......而且它不是。
然后3个问题;)
这是一段视频: https://youtu.be/_bOWGMGesgk
以下是代码:
<div class="wrapperFlex withNextButton">
<div class="itemTitle">
<div class="text">
{{'paramQuestions.weight' | translate }}
</div>
</div>
<div id="weightdata" class="itemParameters weightdataclass row">
<input class="weightinput" type="number" name="userweight" ng-min="{{data.minWeight}}" ng-max="{{data.maxWeight}}" ng-model="data.realWeight" ng-change="updateViewGenVol(data.weightunit, data.userweight, data.BLfactorValue);saveUserWeight()" select-on-focus required></input>
<div class="weightunitradios">
<ion-checkbox class="checkboxes checkbox-blueboardline" ng-model="data.weightunit" ng-true-value="'kg'" ng-false-value="'lbs'" ng-change="saveWeightUnit(); changeMinMax(); convertWeightInput(); saveUserWeight();">kg</ion-checkbox>
<ion-checkbox class="checkboxes checkbox-blueboardline" ng-model="data.weightunit" ng-true-value="'lbs'" ng-false-value="'kg'" ng-change="saveWeightUnit(); changeMinMax(); convertWeightInput(); saveUserWeight();">lbs</ion-checkbox>
</div>
</div>
</div>
directives.js:
.directive('selectOnFocus', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var focusedElement = null;
element.on('focus', function () {
var self = this;
if (focusedElement != self) {
focusedElement = self;
$timeout(function () {
self.select();
}, 10);
}
});
element.on('blur', function () {
focusedElement = null;
});
}
}
})
答案 0 :(得分:4)
对于键盘/滚动问题,我没有找到比这个指令更好的(仅适用于ios):
sencha app watch
答案 1 :(得分:0)
Ionic默认支持此功能。查看keyboard-attach
属性指令。
keyboard-attach是一个属性指令,当键盘显示时,它会使元素浮动到键盘上方。目前仅支持ion-footer-bar指令。
<ion-footer-bar align-title="left" keyboard-attach class="bar-assertive">
<h1 class="title">Title!</h1>
</ion-footer-bar>
来源:http://ionicframework.com/docs/api/directive/keyboardAttach/