html52.com
我爱小程序-开发者交流社区

wx.chooseImage IOS背景图问题

问题模块 框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
客户端 小程序 Bug iOS iOS 10.1.2 iphoneX,iphone5S 6.6.6
/* 选择照片 */
    selectPhoto(){
        wx.chooseImage({
            count: 1,
            sizeType: ['original'],
            sourceType: ['album', 'camera'],
            success: (res)=> {
                console.log(res);
                this.setData({
                    tempFilePaths: res.tempFilePaths[0]
                });
            }
        })
    }
<view class='{{tempFilePaths?"isFile":""}}' style='background-image:url("{{tempFilePaths}}");'></view>


源码如上,在安卓是没有问题的,开发工具也有没有问题,当前测试iphoneX和iphone5S都不显示图片。但是如果不用背景图片,用 <image> 的 src  是可以显示的,但是做不到我要的图片拉伸和对齐效果。请官方大大和各位大佬指点!谢谢!

网友回复

逆流、顶梁:

用image的mode可以大致实现你要的效果。

大叔·杨:

我是直接用image实现的,然后选用了mode =aspectFill

https://developers.weixin.qq.com/miniprogram/dev/component/image.html


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付