国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin

這篇具有很好參考價值的文章主要介紹了Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin,vue,uni-app,javascript,前端,vue.js

只要在后面加上.catch((e) => {}),就不會報錯了,

const queGetdata = (params, context) => {
	
	return new Promise((resolve, reject) => {
		appVue.$http.post(appVue.$apis.getdata,
			{
			  gcode: 'QUERY_CUSTBILL'
			}, {
				isAutoLoading: false, //是否展示loading
			}).then(resp => {
				console.log("觸發(fā)進來了222222")
			let data = resp.responseBody.paramdata; 
			console.log("觸發(fā)進來了"+JSON.stringify(data[0]))
			
			// commit必須放在后面,不然會報錯“Uncaught (in promise) TypeError: Cannot read properties of undefined (readin”
			context.commit("setCustbill", JSON.parse(JSON.stringify(data[0])))
			console.log("觸發(fā)data[0]"+JSON.stringify(data[0]))
			resolve(data[0])
			
		}).catch(error => {
			reject(error)  // 這里報error寫進去就不會報錯,注意注意 Uncaught (in promise)
		});
	})
}

?

Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin,vue,uni-app,javascript,前端,vue.js

?這個問題的解決要想resolve(),在commit()不然就會報錯,注意:先后的順序文章來源地址http://www.zghlxwxcb.cn/news/detail-699911.html

const queGetdata = (params, context) => {
	
	return new Promise((resolve, reject) => {
		appVue.$http.post(appVue.$apis.getdata,
			{
			  gcode: 'QUERY_CUSTBILL'
			}, {
				isAutoLoading: false, //是否展示loading
			}).then(resp => {
				console.log("觸發(fā)進來了222222")
			let data = resp.responseBody.paramdata; 
			console.log("觸發(fā)進來了"+JSON.stringify(data[0]))
			resolve(data[0])
			// commit必須放在后面,不然會報錯“Uncaught (in promise) TypeError: Cannot read properties of undefined (readin”
			context.commit("setCustbill", JSON.parse(JSON.stringify(data[0])))
			console.log("觸發(fā)data[0]"+JSON.stringify(data[0]))
			
			
		}).catch(error => {
			reject(error)
		});
	})
}

到了這里,關(guān)于Uncaught (in promise)和Uncaught (in promise) TypeError: Cannot read properties of undefined (readin的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包