2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
|
|
|
<div :style="{
|
|
|
|
width: `${percent}%`,
|
|
|
|
height: height,
|
|
|
|
opacity: show ? 1 : 0,
|
|
|
|
'background-color': canSuccess ? color : failedColor
|
|
|
|
}" class="progress"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
// https://github.com/nuxt/nuxt.js/blob/master/lib/app/components/nuxt-loading.vue
|
2023-12-01 17:57:14 +00:00
|
|
|
import { computed } from 'vue'
|
|
|
|
import { useAppStore } from '../stores/app';
|
2023-10-19 13:44:40 +00:00
|
|
|
|
2022-09-20 19:59:52 +00:00
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
height: '2px',
|
|
|
|
color: '#77b6ff',
|
|
|
|
failedColor: 'red'
|
|
|
|
}),
|
|
|
|
|
2023-12-01 17:57:14 +00:00
|
|
|
setup () {
|
|
|
|
const appStore = useAppStore()
|
|
|
|
return {
|
|
|
|
percent : computed(() => appStore.loader.percent),
|
|
|
|
canSuccess : computed(() => appStore.loader.canSuccess),
|
|
|
|
show : computed(() => appStore.loader.show)
|
|
|
|
}
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.progress {
|
|
|
|
position: fixed;
|
|
|
|
top: 0px;
|
|
|
|
left: 0px;
|
|
|
|
right: 0px;
|
|
|
|
height: 2px;
|
|
|
|
width: 0%;
|
|
|
|
transition: width 0.2s, opacity 0.4s;
|
|
|
|
opacity: 1;
|
|
|
|
background-color: #efc14e;
|
|
|
|
z-index: 999999;
|
|
|
|
}
|
|
|
|
</style>
|