javascript - promise.then(); La fonction entre parenthèses ne sera pas exécutée.
为情所困
为情所困 2017-07-07 10:34:47
0
1
1351
var promise = new Promise(function(resolve,rejeact){
                        var item=res.data.resultData;
                        if(item.c1_platform_price==""){
                            document.querySelector(".Js_c1Item").style.display="none";
                        }
                        if(item.c2_platform_price==""){
                            document.querySelector(".Js_c2Item").style.display="none";
                        }
                        var banPhoto=document.querySelector(".Js_banPhoto");
                        banPhoto.src=` img/place/${res.data.resultData.drivingSchoolImg}`;
                        page.c1_platform_price = item.c1_platform_price;
                        page.c2_platform_price = item.c2_platform_price;
                        page.desc="";
                         if(!page.c1_platform_price==""){
                            page.desc+=`C1平台价:${page.c1_platform_price}`;
                        }
                        if(!page.c2_platform_price==""){
                            page.desc+=`C2平台价:${page.c2_platform_price}`;
                        }
                        page.eventName = item.eventName;
                        var _html="<span>招收范围:</span>";
                        schoolName.innerHTML=page.eventName;
                        address.innerHTML=item.drvingSchoolAddress;
                        item.eventAreaData.forEach(function(data){
                            _html+=`<span class="item">${data.area}</span>`;
                        })
                        range.innerHTML=_html;
                        c1_platform_price.innerHTML=page.c1_platform_price;
                        c1_retail_price.innerHTML=item.c1_retail_price;
                        c2_platform_price.innerHTML=page.c2_platform_price;
                        c2_retail_price.innerHTML=item.c2_retail_price;
                        c1_exam_price.innerHTML=item.c1_exam_price;
                        c2_exam_price.innerHTML=item.c2_exam_price
                        customerName.innerHTML=item.customerName;
                        mobile.innerHTML=item.mobile;
                        page.drivingSchoolLog = item.drivingSchoolLog;
                        document.querySelector(".Js_qrcodeName").src=`../FileAllinOne/marketingQrCode/${page.customerId}/${page.eventId}/${item.qrcodeName}`;
                        return promise;
                        });
promise.then(function(){
                       console.log('Resolved');                
                       page.complete();
                        
                        });
为情所困
为情所困

répondre à tous(1)
phpcn_u1582

La fonction de promesse n'a pas de résolution. Veuillez vous référer au code ci-dessous pour la méthode d'écriture correcte

var promise = new Promise((resolve, reject) => {resolve(1)});
promise.then((data) => { console.log(data)});
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal