mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 00:38:35 +00:00
Update the nuxt3 version. Co-authored-by: Jonathan Adeline <jonathan@baserow.io> Co-authored-by: Bram Wiepjes <bramw@protonmail.com> Co-authored-by: Cezary <cezary@baserow.io> Co-authored-by: Tsering Paljor <tsering@baserow.io> Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io> Co-authored-by: Bram <bram2w@users.noreply.github.com>
43 lines
842 B
Vue
43 lines
842 B
Vue
<template>
|
|
<div
|
|
class="badge-counter"
|
|
:class="{ 'badge-counter--one-digit': hasOneDigitOnly }"
|
|
>
|
|
{{ value }}
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'BadgeCounter',
|
|
props: {
|
|
/**
|
|
* The number to display in the badge
|
|
*/
|
|
count: {
|
|
type: Number,
|
|
default: 1,
|
|
},
|
|
/**
|
|
* The maximum number to display in the badge.
|
|
* If the count value is higher the badge will display the limit value minus one with a plus sign.
|
|
*/
|
|
limit: {
|
|
type: Number,
|
|
required: false,
|
|
default: 10,
|
|
},
|
|
},
|
|
computed: {
|
|
value() {
|
|
if (this.count > 1 && this.limit > 1 && this.count >= this.limit)
|
|
return `${this.limit - 1}+`
|
|
return this.count
|
|
},
|
|
hasOneDigitOnly() {
|
|
return this.value.toString().length < 2
|
|
},
|
|
},
|
|
}
|
|
</script>
|