es6格式整理后不成功
<script type="text/babel">
const p1 = new Promise(function(resolve, reject) {
setTimeout(() => reject(new Error('fail')), 3000)
})
const p2 = new Promise(function(resolve, reject) {
setTimeout(() => resolve(p1), 1000)
})
p2
.then(result => console.log(result))
.catch(error => console.log(error))
</script>
这段通过格式整理会自动注释掉,或报错
,但是把type="text/babel"改为type="text/javascript"就可以。。。
0 个回复