这样写法错在哪?为什么报错找不到rs,跟直接写then(function(rs){})有什么区别??
let vm = new Vue({
el: '#wrap',
data: {
rs: ''
},
methods: {
getData(type, url, dataObject, okcallback, ercallback) {
if (String(type).toLowerCase() == 'get' && dataObject) {
axios.get(url, {
params: dataObject
}).then(okcallback)
.catch(ercallback)
} else if (!dataObject) {
axios.get(url).then(okcallback)
.catch(ercallback)
} else {
axios.post(url, qs.stringfy(dataObject)).then(okcallback).catch(ercallback)
}
},
resultSuccess(rs) {
console.log('aaa');
// vm.rs = rs;
// console.log(vm.rs, rs);
},
resultError(err) {
}
},
mounted() {
console.log('mounted over');
this.getData('GET', url,'', this.resultSuccess, this.resultError);
},
})
dataObject这个参数?参数的位置错了吧