Logo

GitLab

Sign in

tutorial / mini-app

  • Back to Group
  • Project
  • Activity
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • mini-app
  • official
  • page
  • API
  • pages
  • download-file
  • download-file.js
  • 自动登录,及配置文件修改
    15424199
    zhaoxing authored
    2017-08-14 14:07:50 +0800  
    Browse Code ยป
download-file.js 470 Bytes
Edit Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
const downloadExampleUrl = require('../../../../config').downloadExampleUrl

Page({
  downloadImage: function() {
    var self = this

    wx.downloadFile({
      url: downloadExampleUrl,
      success: function(res) {
        console.log('downloadFile success, res is', res)

        self.setData({
          imageSrc: res.tempFilePath
        })
      },
      fail: function({errMsg}) {
        console.log('downloadFile fail, err is:', errMsg)
      }
    })
  }
})