原地址連接:https://blog.csdn.net/august_leo/article/details/80877382小程序
這是微信小程序input組件的官方文檔描述,下圖紅框裏的placeholder-style
和placeholder-class
就是微信小程序裏用來給placeholder設置樣式的屬性。 微信小程序
placeholder-style至關於在標籤的style屬性,可直接在標籤內設置。微信
<input type="text" placeholder="請輸入" placeholder-style="color:#e2e2e2;"></input>
示例以下:xss
wxml代碼:spa
<input type="text" placeholder="請輸入" placeholder-style="color:#000;"></input>
wxss代碼:.net
input{ width: 300rpx; border: 2rpx solid #000; margin: 50rpx auto; border-radius:10rpx; }
用法:code
wxml代碼:xml
<input type="text" placeholder="請輸入" placeholder-class="placeholderStyle"></input>
wxss代碼:blog
.placeholderStyle{ //樣式 }