<script>
const request = function(){
var _this = this;
let num = Math.round(Math.random()*100)/100;
console.log( num );
return new Promise( (resolve, reject) => {
setTimeout(function(){
num < 0.5 ? resolve('1234567') : reject('abcdefg');
}, 500);
});
}
// var getdata = new request();
request().then( val => {
console.info( val );
}, val => {
console.info( val );
}).catch( err => {
console.info( err );
});
</script>
版权声明:本文为wsq926原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。