2 Star 0 Fork 0

tommyrunner / web-loading

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.html 2.05 KB
一键复制 编辑 原始数据 按行查看 历史
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>web-loading</title>
<script defer="defer" src="./dist/web-loading.js"></script>
</head>
<body>
<div id="app">
<div class="item">
<div>
id:
<span class="value">001</span>
</div>
<div>
user:
<span class="value">use1</span>
</div>
</div>
</div>
<!-- <script src="https://cdn.jsdelivr.net/npm/web-loading"></script> -->
<script>
window.onload = () => {
// encapsulation
let modelDefOptions = {
size: 10
}
class CustomLoading extends BaseModel {
constructor(w, h, canvas, options, store) {
super(w, h, canvas, options, store, modelDefOptions)
this.run(this.draw)
}
draw() {
this.clearRect()
let op = this.options
this.ctx.fillRect(-op.size / 2, -op.size / 2, op.size, op.size)
}
}
// loading
let docApp = document.querySelector('#app')
const webLoading = fullLoading({
// custom: CustomLoading,
model: 'Ring'
// notFeel: 1000,
// size: 20
})
window.addEventListener('resize', webLoading.resize)
webLoading.loading(docApp)
setTimeout(() => {
webLoading.close()
}, 300)
}
</script>
</body>
<style>
#app {
margin: 12px;
padding: 12px;
height: 200px;
border: 1px solid gray;
overflow: auto;
border-radius: 5px;
}
#app .item {
display: flex;
flex-direction: column;
border: 1px solid gray;
border-radius: 5px;
padding: 10px;
line-height: 30px;
margin-bottom: 6px;
height: 60px;
}
#app .item .value {
display: inline-block;
min-width: 31px;
min-height: 16px;
font-weight: bold;
color: rgb(64, 158, 255);
}
</style>
</html>
1
https://gitee.com/tommyrunner/web-loading.git
git@gitee.com:tommyrunner/web-loading.git
tommyrunner
web-loading
web-loading
master

搜索帮助