Created
May 31, 2021 07:06
-
-
Save zyrouge/26e6cdd3384ab43a77149b4c6eebeb38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Progress Bar</title> | |
| <script src="https://unpkg.com/vue@next"></script> | |
| </head> | |
| <body> | |
| <main> | |
| <div id="app"> | |
| <div id="bar"> | |
| <span id="progress" :style="{ width: `${value}%` }"></span> | |
| </div> | |
| </div> | |
| </main> | |
| <script defer> | |
| const app = Vue.createApp({ | |
| data() { | |
| return { | |
| value: 0.0 | |
| } | |
| }, | |
| mounted() { | |
| setInterval(() => { | |
| this.value = this.value >= 100 ? 0 : this.value + 0.1; | |
| }, 10); | |
| } | |
| }); | |
| app.mount("#app"); | |
| </script> | |
| <style> | |
| #bar { | |
| background-color: rgb(223, 223, 223); | |
| width: 100%; | |
| height: 1rem; | |
| border-radius: 1rem; | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| #progress { | |
| position: absolute; | |
| height: 100%; | |
| background-color: #000; | |
| } | |
| </style> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment