2017-08-24 122 views
1

如何在Ionic 2中自动换行ion-input组件?如何将Wrap离子输入包裹在离子2+中?

这工作:

<ion-item text-wrap> 
    <div>A really realll really really loooooooonnngg text.</div> 
</ion-item> 

但这并不:

<ion-item text-wrap> 
    <ion-input 
    type="text" 
    id="commuterLocation" 
    name="commuterLocation" 
    readonly=true 
    placeholder="Enter your location" 
    (focus)="onCommuterLocationFocus()" 
    [(ngModel)]="_commuterLocation.description"></ion-input> 
</ion-item> 

编辑1: 当我使用text-wrap指令上ion-item定期html元素,元素内容如预期包裹。但ion-input的输入文本不...我该如何解决这个问题?在此先感谢您的帮助。

+2

为什么不使用ion-texarea? – SergioEscudero

+0

你想达到什么目的?你可以添加一个截图或其他东西?它仅用于造型吗?因为离子项目中的输入不会比屏幕分辨率更进一步。 – Sonicd300

+0

@SergioEscudero嗯......去试试... – DevITper

回答

8

通过使用ion-textarea而不是ion-input解决了此问题。

<ion-item text-wrap> 
    <ion-textarea 
    type="text" 
    id="commuterLocation" 
    name="commuterLocation" 
    readonly=true 
    placeholder="Enter your location" 
    (focus)="onCommuterLocationFocus()" 
    [(ngModel)]="_commuterLocation.description"></ion-textarea> 
</ion-item>