input type datetime-local 解决移动端显示placeholder.
今天在做移动端后台的时候,又一个付款时间的栏目需要用到input type datetime-local
css
input[type="date"]:before{
color:#A9A9A9;
content:attr(placeholder);
}
input[type="date"].full:before {
color:black;
content:""!important;
}
html
<input type="datetime-local" :class="[item.pay_time ? 'full' : '', 'date-time','weui-input']" placeholder="请选择付款时间" v-model="item.pay_time" />
通过v-model绑定来判断input是否有值来给其添加类名’full’,然后就解决了。