账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    WXImageComponent BorderRadius 的设置为啥没使用_addUITask?
    31
    0

    问题描述

    修改图片大小,图片无法完全显示。 我们用的版本weex 0.18.

    相关代码

    <template>
      <div >
        <image :class='[tapFlag == 1 ? "image1" : "image2"]'  src="https://vuejs.org/images/logo.png" @click="onclick"></image>
      </div>
    </template>
    
    <style scoped>
    
      .image1 {
        width:270px;
        height:280px;
        border-top-right-radius: 100px;
      }
      .image2 {
        width:470px;
        height:480px;
        border-top-right-radius: 100px;
      }
    </style>
    
    <script>
    export default {
      data:{
        tapFlag : 1
      },
      methods: {
        onclick() {
          if(1 == this.tapFlag){
            this.tapFlag = 2
          } else {
            this.tapFlag = 1
          }
        }
      }
    }
    </script>

    你期待的结果是什么?实际看到的错误信息又是什么?

    查看源码 发现:

    - (void)_frameDidCalculated:(BOOL)isChanged
    {
        [super _frameDidCalculated:isChanged];
        
        if ([self isViewLoaded] && isChanged) {
            __weak typeof(self) weakSelf = self;
            WXPerformBlockOnMainThread(^{
                [weakSelf _clipsToBounds];
            });
        }
    }

    查看新最新源码发现

     - (void)_resetNativeBorderRadius 方法中添加了
      [self _clipsToBounds];

    解决了问题。

    疑问

    为什么不这样

    - (void)_frameDidCalculated:(BOOL)isChanged
    {
        [super _frameDidCalculated:isChanged];
        
        if ([self isViewLoaded] && isChanged) {
            __weak typeof(self) weakSelf = self;
                    [self.weexInstance.componentManager _addUITask:^{
                __strong typeof(weakSelf) strongSelf = weakSelf;
                if (strongSelf == nil) {
                   return;
                }
                [strongSelf _clipsToBounds];
            }];
        }
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 心尚温 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部