위챗 애플릿을 로컬에 저장

2387 단어 위챗
마운트:링크 열기

 wx.getImageInfo({
            src: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white_fe6da1ec.png',
            success: function (ret) {
                var path = ret.path;
                wx.saveImageToPhotosAlbum({
                    filePath: path,
                    success(result) {
                        console.log(result)
                    }
                })
            }
        })

 

  download ,  tempFilePath wx.saveImageToPhotosAlbum filePath 
wx.downloadFile({
  url: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white_fe6da1ec.png',
  success: function (res) {

    wx.saveImageToPhotosAlbum({
      filePath: res.tempFilePath,
      success(result) {
        console.log(result)
      }
    })

    wx.saveFile({
      tempFilePath: res.tempFilePath,
      success: function (res) {
        console.log(res.savedFilePath) 
      }
    })
    
  }
})

 

wx.getImageInfo({
  src: '../images/shareimg.jpg',
  success: function (res) {
    console.log(res.path)
    wx.getSetting({
      success(res) {
        if (!res.authSetting['scope.writePhotosAlbum']) {
          wx.authorize({
            scope: 'scope.writePhotosAlbum',
            success() {
              wx.saveImageToPhotosAlbum({
                filePath: res.path,
                success(result) {
                  console.log(result)
                }
              })
            }
          })
        }
      }
    })
  }
})

좋은 웹페이지 즐겨찾기