zoukankan      html  css  js  c++  java
  • uniapp保存网络图片到相册

    //下载网络图片
        saveHttpImg(url){
        let _t = this;
           uni.downloadFile({
                            url:url, //仅为示例,并非真实的资源
                            success: (res) => {
                                    if (res.statusCode === 200) {
                                            let file = res.tempFilePath;
                                            _t.save(file)
                                    }
                            }
                    });
                },
    //保存图片到本地
                save(url){
                  let _this = this;
                    _this.$util._loading("保存中...");
                    uni.saveImageToPhotosAlbum({
                        filePath: url,
                        success: () => {
                            uni.hideLoading();
                            _this.$util._toast("图片已保存");
                        },
                        fail: () => {
                            uni.hideLoading();
                            _this.$util._toast("保存失败");
                        },
                        complete: () => {
                        
                        }
                    });
              },
  • 相关阅读:
    Nginx配置文件详解
    Mycat概述
    日志切割之Logrotate
    js数组(二)
    js数组(一)
    sass颜色
    scss
    HTML5新属性
    HTML5新元素
    Bootstrap
  • 原文地址:https://www.cnblogs.com/jyc226/p/13261587.html
Copyright © 2011-2022 走看看