ionic3中 input怎么获取焦点<input type="search" placeholder="请输入关键字,以便查询相关信息" [(ngModel)]="myInput" class="search" (ngModelChange)="onInput()">import { Component,ElementRef } from '@angular/core';export class AddBankcardPage{ private ab;//申明 constructor( public ele:ElementRef){ this.ab=this.ele.nativeElement.querySelector('.search'); console.log("------------"+this.ab); //获取不到dom this.ab.focus();}}
添加回答
举报
0/150
提交
取消