一、问题描述:
- input框中的placeholder属性是可以更改样式,更改的方式为placeholder-class="你的style名"
example:
<view class="top_one">
<text>姓名</text>
<input type="text" placeholder="请输入姓名" placeholder-class="placeholder_class"/> //(注释)这里---- placeholder_text
</view>
<view class="top_two">
<text>手机号码</text><input type="number" placeholder="手机号" />
</view>
<style>
.placeholder_class {
font-family: 'Source Han Sans CN';
font-weight: 350;
font-size: 24rpx;
color: #747474;
}
</style>
二、解决办法:
- 但是这个属性如果使用了<style scoped>就不生效,所以我们可以单独再写一个style:
<style>
.placeholder-class {
color: #BFBFBF;
}
</style>
<style scoped lang="scss">
.placeholder-class {
color: #BFBFBF;
}
</style>