代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
{{ message }}
</div>
</body>
<script>
for (let i = 0; i < 5; i++) {
setTimeout(function () {
console.log('异步任务', i);
}, 200);
}
console.log('同步任务', i);//Uncaught ReferenceError: i is not defined
</script>
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
setTimeout(function () {
console.log('定时器setTimeout')//5
}, 0);
new Promise(function (resolve) {
console.log('同步任务1');//1
for (var i = 0; i < 10000; i++) {
i == 99 && resolve();
}
}).then(function () {
console.log('Promise.then')//3
});
app.$nextTick(() => {
console.log('nextTick')//4
})
console.log('同步任务2');//2
</script> -->
<!-- <script>
setTimeout(() => {
console.log('1')
Promise.resolve().then(() => {
console.log('2')
})
}, 0)
new Promise((resolve, reject) => {
console.log('3')
resolve()
})
.then(res => {
console.log('4');
})
console.log('5')
</script> -->
<!--
<script>
console.log('1')
setTimeout(function callback() {
console.log('2')
}, 1000)
new Promise((resolve, reject) => {
console.log('3')
resolve()
})
.then(res => {
console.log('4');
})
console.log('5')
</script> -->
<!-- <script>
console.log('1')
setTimeout(function () {
console.log('2')
}, 1000)
console.log('3')
</script> -->
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。