opnform/resources/js/components/Loading.vue

46 lines
859 B
Vue
Raw Normal View History

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-10-19 13:44:40 +00:00
import { mapState } from 'vuex'
2022-09-20 19:59:52 +00:00
export default {
data: () => ({
height: '2px',
color: '#77b6ff',
failedColor: 'red'
}),
2023-10-19 13:44:40 +00:00
computed: {
...mapState({
percent: state => state.app.loader.percent,
canSuccess: state => state.app.loader.canSuccess,
show: state => state.app.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>