Webzhoushifa

原地址链接:https://blog.csdn.net/august_leo/article/details/80877382

这是微信小程序input组件的官方文档描述,下图红框里的placeholder-styleplaceholder-class就是微信小程序里用来给placeholder设置样式的属性。 

一、使用placeholder-style设置样式

placeholder-style相当于在标签的style属性,可直接在标签内设置。

<input type="text" placeholder="请输入" placeholder-style="color:#e2e2e2;"></input>

示例如下:

wxml代码:

<input type="text" placeholder="请输入" placeholder-style="color:#000;"></input>

wxss代码:

input{
  width: 300rpx;
  border: 2rpx solid #000;
  margin: 50rpx auto;
  border-radius:10rpx; 
}

二、使用placeholder-class设置样式

用法:

wxml代码:

<input type="text" placeholder="请输入" placeholder-class="placeholderStyle"></input>

wxss代码:

.placeholderStyle{
  //样式
}

 

分类:

技术点:

相关文章:

  • 2022-01-01
  • 2021-11-23
  • 2021-05-01
  • 2022-01-06
  • 2021-09-02
  • 2021-10-22
猜你喜欢
  • 2021-07-13
  • 2021-08-08
  • 2021-10-21
  • 2021-07-21
  • 2021-08-10
  • 2021-12-12
  • 2021-12-07
相关资源
相似解决方案