refs #3301 Rewrite organisms/StatusLoading with composition API

This commit is contained in:
AkiraFukushima 2022-05-21 21:31:18 +09:00
parent 03e600559d
commit 46fdd7381a
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
1 changed files with 26 additions and 20 deletions

View File

@ -1,45 +1,51 @@
<template>
<div class="status-loading" tabIndex="0" @click="onClick">
<img
v-if="loading"
src="../../assets/images/loading-spinner-wide.svg"
class="load-icon"
/>
<img v-if="loading" src="../../assets/images/loading-spinner-wide.svg" class="load-icon" />
<p v-else class="load-text">{{ $t('cards.status_loading.message') }}</p>
<div class="fill-line"></div>
</div>
</template>
<script>
export default {
<script lang="ts">
import { defineComponent, toRefs } from 'vue'
export default defineComponent({
name: 'status-loading',
props: {
max_id: {
type: String,
default: '',
default: ''
},
since_id: {
type: String,
default: '',
default: ''
},
loading: {
type: Boolean,
default: false,
},
default: false
}
},
methods: {
onClick() {
if (this.loading) {
setup(props, ctx) {
const { loading, since_id, max_id } = toRefs(props)
const onClick = () => {
if (loading.value) {
return
}
if (this.since_id !== '') {
this.$emit('load_since', this.since_id)
} else if (this.max_id !== '') {
this.$emit('load_max', this.max_id)
if (since_id.value !== '') {
ctx.emit('load_since', since_id.value)
} else if (max_id.value !== '') {
ctx.emit('load_max', max_id.value)
}
},
}
return {
onClick
}
},
}
methods: {
onClick() {}
}
})
</script>
<style lang="scss" scoped>