用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()执行?
添加回答
举报
0/150
提交
取消