第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Ionic2學(xué)習(xí)基礎(chǔ)之Input組件

標(biāo)簽:
JavaScript iOS AngularJS
Ionic2组件之Input

ion-input is meant for text type inputs only, such as text, password, email, number, search, tel, and url. Ionic still uses an actual <input type="text"> HTML element within the component, however, with Ionic wrapping the native HTML input element it's able to better handle the user experience and interactivity.
Similarily, <ion-textarea> should be used in place of <textarea>.
An ion-input is not used for non-text type inputs, such as a checkbox, radio, toggle, range, select, etc.

ion-input组件是作为文本输入组件,和html中的类型为text的input类似,但是它不能作为checkbox,radio,toggle,range,select这些input来使用。
此外,和html5中相同,ion-input也有text,password,email,number,search,tel和url这些类型。

相关属性

input有以下属性:

  • type : HTML的input类型,有(text, password, email, number, search, tel, 或 url)
  • placeholder : 同html中的用法
  • clearInput : 是否在后面显示小叉
  • value : input的值
  • disabled : 是否禁用
  • mode : 暂时没有发现怎么用
  • clearOnEdit : 暂时没有发现怎么用

用法如下:

<ion-content padding>
    <ion-list>
        <ion-item>
            <ion-label color="danger">inline label</ion-label>
            <ion-input color="danger" placeholder="inline label" clearOnEdit="true"></ion-input>
        </ion-item>
        <ion-item>
            <ion-label color="danger" fixed>fixed label</ion-label>
            <ion-input placeholder="fixed label" clearInput  disabled="true" ></ion-input>
        </ion-item>
        <ion-item>
            <ion-label>number</ion-label>
            <ion-input type="number"></ion-input>
        </ion-item>
    </ion-list>
</ion-content>
浮动显示标签和固定显示标签

常用的input有三种和标签组合方式:

  • 无标签,通过placeholder方式展示需要输入的内容
  • floating,不输入时标签和input一行,当input输入内容后label浮到上一行
  • stacked,固定浮在input上面一行

使用方式如下:

<ion-item>
    <ion-label floating>floating</ion-label>
    <ion-input placeholder="floating"></ion-input>
</ion-item>
<ion-item>
    <ion-label stacked>stacked</ion-label>
    <ion-input placeholder="stacked"></ion-input>
</ion-item>
focus和blur事件

利用angular2的方法,调用blurfocus方法
使用方式如下:

<ion-input placeholder="floating" (blur)="blurInput()" (focus)="focusInput()"></ion-input>

typescript代码如下:

export class InputPage{
    constructor(public navCtrl:NavController){

    }
    blurInput(){
        console.log("blur");
    }

    focusInput(){
        console.log("focus");
    }
}

博客原文地址

點(diǎn)擊查看更多內(nèi)容
8人點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消