为啥按照课程里面说的方法写,会报错。
class GetData {
constructor() {
}
getBannerData() {
wx.request({
url: 'https://pos.mhdz.ltd/api/v2/index/banners',
method: 'POST',
success: function (res) {
console.log(res);
return res;
}
})
}
}
export { GetData };
// module.exports = GetData;
import { GetData } from './index-model.js';
let common = new GetData();
VM4281:1 thirdScriptError
sdk uncaught third Error
Unexpected token export
SyntaxError: Unexpected token export
console.error @ VM4281:1
(anonymous) @ WAService.js:1
(anonymous) @ WAService.js:1
e @ appservice?t=1554638841902:1208
window.onerror @ VM4281:1
VM4281:1 thirdScriptError
sdk uncaught third Error
Unexpected token import
SyntaxError: Unexpected token import
然后export 和 import 都报错。