... is not a constructor
写了一个ES6的类,不勾选ES6转ES5的时候显示 Unexpected export module,勾选后显示 … is not a constructor,请问是什么原因呢?
class MDb { constructor(){ this .storageKeyName = 'Odata' ; } // 获取所有数据 getAllOdata(){ var res = wx.getStorageSync( this .storageKeyName); if (!res){ res = require( '../data/data.js' ).Odata; this .execSetStorageSync(res); } return res; } // 保存或更新缓存数据 execSetStorageSync(data){ wx.setStorageSync( this .storageKeyName, data); } };
|