屬性 | 功能 | 示例 |
placeholder |
輸入框空時(shí),提示文字? | placeholder=“請輸入用戶名” |
placeholder-style | 輸入框,提示文字的樣式 | placeholder-style= "color:rgb(170,170,170); margin-left:?20px;" |
placeholder-class | placeholder 的樣式類 | 用class樣式修改 |
cursor-spacing | 指定的光標(biāo)與彈出鍵盤的距離 | cursor-spacing="50" |
type | text:文本輸入 idcard:身份證輸入鍵盤 digit:帶小數(shù)點(diǎn)的數(shù)字鍵盤 nickname:昵稱輸入鍵盤 |
|
password | 密碼格式 | |
disabled | 只讀,禁用輸入 | disabled="false" |
maxlength | 最大輸入長度,設(shè)置為 -1 的時(shí)候不限制最大長度 | maxlength=“-1” |
focus | 獲得焦點(diǎn) | focus="true" |
在view中的垂直居中 | display:?flex;align-items:?center; |
|
在view中的左右水平居中 | display:?flex;justify-content:?center; |
|
官方文檔:
input | 微信開放文檔微信開發(fā)者平臺文檔https://developers.weixin.qq.com/miniprogram/dev/component/input.html
二、實(shí)例1
<view class="boxNumber">
<view>¥</view>
<view>
<input type="digit" placeholder="請輸入金額" placeholder-class="boxNumberInput" adjust-position="true">
</input>
</view>
</view>
二、實(shí)例2,文本框和文本框組合
?文本框
wxml文件文章來源:http://www.zghlxwxcb.cn/news/detail-608000.html
<view class="text">
<input type="text" required="required" placeholder="請輸入手機(jī)號" placeholder-style="color:rgb(170,170,170);">
</input>
</view>
?wxss代碼文章來源地址http://www.zghlxwxcb.cn/news/detail-608000.html
.text {
height: 60px;
width:94%;
margin: 0 auto;
display: flex;
text-align: center;
justify-content: center;
/* background-color:red; */
margin-bottom: 10px;
}
到了這里,關(guān)于【小程序】input輸入框?qū)傩约吧舷伦笥揖又械氖纠▓D文+代碼)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!