用class封裝一個方法:const test=calss{constructor(){
..
this.init()
}
..init(){
//return new Promise( function (resolve, reject) {})}
}init()放入了constructor,但是當去執行new test(a,b,c).then()會提示.then is not a function,必須constructor里移除this.init(),然后執行new test(a,b,c).init().then()才能正常執行,用什么方法怎樣能讓它這樣new test(a,b,c).then()執行?
es6 class類封裝方法疑問
慕村225694
2018-10-23 10:39:53