How to attach Promise? to an image upload plug-in that needs to be initialized

// 
function loadUploadFn() {
    return new Promise(function(resolve, reject) {
        var len = 0;
        /**  */
        var uploadListIns = $upload.render({
            elem: "-sharpuploadBtn",
            url: "../accountManager/uploadWechatCode",
            multiple: true,
            number: 5,
            auto: false,
            bindAction: "-sharpuploadAction",
            allDone: function(obj) {
                resolve(fileURL);
            },
            error: function(index, upload) {
                reject(upload);
            }
        });
    });
}

after, loadUploadFn () is initialized as above, loadUploadFn (). Then (function (res) {/ / can"t be executed here} below)

the picture upload plug-in selects the picture and clicks the -sharpuploadAction button to start uploading.
successfully gets the url and sends it to the backend together with a form, because submitting the form and clicking the -sharpuploadAction button operate at the same time
I want to add a promise to get the picture url after the picture is uploaded, and then request the form interface

.
Jun.07,2021

according to your description, do not submit the form in the function that clicks-sharpuploadAction

Menu