Cannot read property 'type1' of undefined什么错误?
发布于 5 年前 作者 juandu 9959 次浏览 来自 官方Issues

求大神搭救啊,,,,,不胜感激

var app = getApp();

// var arr = app.globalData.proArray;

var favo_icon_b = “/images/ico_3_h.png”;

var favo_icon_c = “/images/ico_31.png”

var color_right = “#00a0e9”;

var color_err = “#eb3b3b”;

var color_blank = “#fff”;

var __chooseOne = 0;

//题库信息

var prosData = []

var index = 0;

var favo_data = []

//获取要做的题库信息

var randomsort = function (a, b) {

return Math.random() > .5 ? -1 : 1

}

var getPros = function (_chooseOne, _chooseTwo, _random) {

prosData = []

var _prosData = JSON.parse(JSON.stringify(app.globalData.prosData))

var baseData = new Object();

__chooseOne = _chooseOne;

switch (_chooseOne) {

case 1:

baseData = _prosData.sect1;

break;

case 2:

baseData = _prosData.sect2;

break;

case 3:

baseData = _prosData.sect3;

break;

}

var baseData2 = []

var type1Data = []

baseData2 = baseData.type1       提示的错误

type1Data = baseData2.concat(_prosData.sect4.type1)

switch (_chooseTwo) {

case 1:

prosData = type1Data;

break;

case 2:

baseData2 = baseData.type2;

var type2Data = baseData2.concat(_prosData.sect4.type2)

prosData = type1Data.concat(type2Data)

break;

}

onLoad: function (options) {

index=0

prosData = []

console.log(options)

var that = this;

that.inquiryFavo(() => {

if (that.checkFavo()) {

that.setData({

favoIcon: favo_icon_c

})

} else {

that.setData({

favoIcon: favo_icon_b

})

}

})

提示错误处     getPros(parseInt(options.chooseNumOne), parseInt(options.chooseNumTwo), options.random)

console.log(prosData)

if (options.random == “true”) {

this.setData({

chooseText: “随机练习”

})

} else {

this.setData({

chooseText: “顺序练习”

})

}

this.setData({

proSum: prosData.length

})

this.loadPro()

},

1 回复

说明baseData为undefined

回到顶部