WeChat Mini Programs calls wx.chooseImage () to select a picture and then jumps to the home page

WeChat Mini Programs calls the API wx.chooseImage () to obtain local photo albums
after the selection, click finish to jump to Mini Program"s home page, and then there is no more

Code:

chooseImage(){
    let that = this;
    wx.chooseImage({
        count: 1, // 9 
        sizeType: ["original", "compressed"], //  
        sourceType: ["album", "camera"], //  
        success(res) {
        // tempFilePathimgsrc 
            this.setData({
            src: res.tempFilePaths[0],
            srcChanged: true
        });
      }
    });
}

I just got in touch with Mini Program. Has any boss ever met with a solution? Thank you very much


do you mean to return to the home page after selecting the picture?


it doesn't make sense, and the code doesn't see anything.
but there seems to be a problem with the code

this.setData({
            src: res.tempFilePaths[0],
            srcChanged: true
});

should be written as

that .setData({
            src: res.tempFilePaths[0],
            srcChanged: true
});

wx.chooseImage will trigger the onShow and onHide, of app.js. If your business logic is written here, there may be problems. There are many solutions:
1. Business logic is written in onLaunch;
2, and a chooseImg tag is set in app.js. By default, false, is prefixed to true, to judge in onShow.
3. Judge the depth of the getCurrentPages (). Length page stack in app.js 's onShow, as follows:

onShow: function (options) {
    let pages = getCurrentPages();
    if(pages.length == 0) {
        this.init();
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c3bd-2c2e1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c3bd-2c2e1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?