輸入框:該組件是原生組件,使用的時候要注意相關的設置
屬性:
value:類型 字符串 輸入框的初始內容
type:類型 字符串 input類型
屬性值:text 文本輸入鍵盤
number 數字輸入鍵盤
idcard 身份證輸入鍵盤
digit 帶小數點的數字鍵盤
password:類型 布爾 是否是密碼類型
placeholder:類型 字符串 輸入框為空時占位符
placeholder-style:類型 字符串 指定 placeholder 樣式
placeholder-class:類型 字符串 指定 placeholder 的樣式類
disabled:類型 布爾 是否禁用
maxlength:類型 數字 最大輸入長度,設置為-1時,不限制最大長度
cursor-spacing:類型 數字 指定光標與鍵盤的距離
focus:類型 布爾 獲取焦點
confirm-type:類型 字符串 設置鍵盤右下角按鈕的文字,僅在 type="text' 時生效
屬性值:send 右下角按鈕為"發送"
search 右下角按鈕為"搜索"
next 右下角按鈕為"下一個"
go 右下角按鈕為"前往"
done 右下角按鈕為"完成"
confirm-hold:類型 布爾 點擊鍵盤右下角按鈕是否保持鍵盤不收起
cursor:類型 數字 指定 focus 的光標位置
selection-start:類型 數字 光標的起始位置,自動聚焦時有效 需與 selection-end 搭配使用
selection-end:類型 數字 光標的結束位置,自動聚焦時有效 須臾selection-start 搭配使用
adjust-position:類型 布爾 鍵盤彈起時,是否自動上推頁面
事件:
bindinput: 鍵盤輸入時觸發
bindfocus: 輸入框聚焦時觸發
bindblur: 輸入框失去焦點時觸發
bindconfirm: 點擊完成按鈕時觸發