This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/components/common/Loading.vue

64 lines
1.1 KiB
Vue
Raw Normal View History

2022-01-16 23:16:00 +08:00
<template>
<div class="chart__loading" v-show="showLoading">
2022-05-26 17:14:00 +08:00
<img :class="className" :src="path" alt="" :style="innerStyle">
2022-01-16 23:16:00 +08:00
</div>
</template>
<script>
export default {
name: 'loading',
props: {
2022-05-26 17:14:00 +08:00
loading: Boolean,
size: {
type: String,
default: 'default' // large default small
},
innerStyle: String
2022-01-16 23:16:00 +08:00
},
data () {
return {
showLoading: false
}
},
methods: {
startLoading () {
this.showLoading = true
},
endLoading () {
this.showLoading = false
}
},
watch: {
loading: {
deep: true,
immediate: true,
handler (n) {
this.showLoading = n
}
}
2022-05-26 17:14:00 +08:00
},
setup (props) {
const path = window.location.protocol + '//' + window.location.host + '/images/loading.gif'
let className = ''
switch (props.size) {
case 'large': {
className = 'loading-img--large'
break
}
case 'small': {
className = 'loading-img--small'
break
}
default: {
className = 'loading-img--default'
break
}
}
return {
path,
className
}
2022-01-16 23:16:00 +08:00
}
}
</script>