PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > HBuilderX教程 > 正文

    uniapp兼容小程序下拉弹框形式展示数据

    作者:admin来源:网络浏览:时间:2020-12-02 11:33:38我要评论
    导读:uniapp兼容小程序下拉弹框形式展示数据
    uniapp兼容小程序下拉弹框形式展示数据

    1. goCamera: function() { 
    2.     let that = this 
    3.     // #ifdef  APP-PLUS 
    4.     uni.chooseImage({ 
    5.      count: 1, //默认9 
    6.      sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 
    7.      sourceType: ['album''camera'], //从相册选择 
    8.      success: function(res) { 
    9.       console.log(res,"app"
    10.       console.log(res.tempFilePaths); 
    11.       // debugger 
    12.       that.shop.img = res.tempFilePaths[0] 
    13.       console.log(that.shop.img) 
    14.        that.url = res.tempFilePaths[0] 
    15.       const tempFilePaths = res.tempFilePaths; 
    16.        
    17.  
    18.      } 
    19.     }); 
    20.     // #endif 
    21.     // #ifdef  MP-WEIXIN 
    22.     wx.showActionSheet({ 
    23.      itemList: ['拍照''从相册中选择'], 
    24.      success(res) { 
    25.       console.log(res.tapIndex,"weixin"
    26.       let sourceType = 'camera' 
    27.       if (res.tapIndex == 0) { 
    28.        sourceType = 'camera' 
    29.       } else if (res.tapIndex == 1) { 
    30.        sourceType = 'album' 
    31.       } 
    32.       wx.chooseImage({ 
    33.        count: 1, 
    34.        sizeType: ['compressed'], 
    35.        sourceType: [sourceType], 
    36.        success: function(res) { 
    37.         console.log(res.tempFilePaths) 
    38.         const tempFilePaths = res.tempFilePaths[0] 
    39.          that.url = res.tempFilePaths[0] 
    40.          console.log(that.url) 
    41.         // uni.uploadFile({ 
    42.         //  url: http.baseUrl + '/uploads/upload-supplier-shop-head-portrait/' + uni.getStorageSync('shopId'), 
    43.         //  methods: "post", 
    44.         //  filePath: tempFilePaths, 
    45.         //  name: 'upload', 
    46.         //  success: function(uploadFileRes) { 
    47.         //   console.log(JSON.parse(uploadFileRes.data).data); 
    48.         //   // _this.imgList = [..._this.imgList, uploadFileRes.data] 
    49.         //   that.shopDetail.shopHeadImgUrl = JSON.parse(uploadFileRes.data).data 
    50.         //  } 
    51.         // }); 
    52.         // this.tui.href('../cropper-default?src=' + that.url); 
    53.         console.log("yaotiaole"
    54.         uni.navigateTo({ 
    55.          url:"./cropper-default?src=" + that.url +"&uploadtype=touxiang&shopId=" + that.shopId + "&shopName=" + that.shopName + "&sourceType=" + sourceType , 
    56.          success: (r) => { 
    57.           console.log(r) 
    58.          } 
    59.         }) 
    60.        }, 
    61.       }) 
    62.      }, 
    63.     }) 


    uniapp兼容小程序下拉弹框形式展示数据

    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-146-6461-1.html