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{
  //样式
}

 

分类:

技术点:

相关文章:

  • 2021-10-14
  • 2021-11-22
  • 2021-08-07
  • 2021-09-01
  • 2021-11-11
  • 2021-12-20
  • 2021-09-07
  • 2021-10-01
猜你喜欢
  • 2021-11-04
  • 2021-10-12
  • 2021-11-03
  • 2021-09-07
  • 2021-09-07
  • 2021-10-31
  • 2021-11-01
相关资源
相似解决方案