编程知识 cdmana.com

Textarea has default padding in IOS

In developing tools and android All normal , stay IOS There will be a default on the real machine padding, Probably 10rpx length .

And this default padding I don't know where to set it , Code not visible .

Set to padding:0 It doesn't work , Set to padding:10rpx It's in effect ...

That is to say padding except 0 Don't take effect , All other values work , It's a real hole .

Solutions : Judge the device as ios when ,margin Set to -10rpx

xwxml Code

class="{
   {isIos?'iostextarea':'weui-textarea'}}"

js Code

stay onLoad in :

var phone = wx.getSystemInfoSync();  // Call method to get model 
    var that = this;
    if (phone.platform == 'ios') {
      that.setData({
        isIos: true
      });
    } else if (phone.platform == 'android') {
      that.setData({
        isIos: false
      });
    }

wxss:

.iostextarea{
  margin-left: -10rpx;
}

 

版权声明
本文为[Monkeys learn to program]所创,转载请带上原文链接,感谢

Scroll to Top