原地址连接: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{ //样式 }