我希望有一个可以聚焦的离子输入,并且键盘不应该出现。有什么办法吗?谢谢!
答案 0 :(得分:0)
是,安装此插件-> https://ionicframework.com/docs/native/keyboard/
html
<ion-input type="text" [(ngModel)]="message" (ionFocus)="keyboard_show()" #input ></ion-input>
ts
import {
Keyboard
} from '@ionic-native/keyboard';
constructor(private keyboard: Keyboard, private ) {
}
keyboard_show(){
this.keyboard.close();
}
答案 1 :(得分:0)
我尝试了凯文(Kevin)的答案,并得到了与米特什(Mitesh)相同的'Keyboard' refers to a value, but is being used as a type here. Did you mean 'typeof Keyboard'?
问题。
我用以下方法解决了这个问题:
import { Keyboard } from '@ionic-native/keyboard/ngx'
@Component({
selector: 'app-upload-root',
templateUrl: 'upload-root.page.html',
styleUrls: ['upload-root.page.scss'],
providers: [Keyboard]
})
constructor(private keyboard: Keyboard)
this.keyboard.hide();
不确定如何或为什么需要它,但对我有用。