This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/NameCount.vue

49 lines
1.3 KiB
Vue
Raw Normal View History

2020-09-29 08:59:23 -07:00
<template>
<ul>
<template v-for="version in versions">
<li v-for="(ordinalDesc, ordinal) in config.names.countOrdinal" class="my-1">
<strong>
{{version}}
<small v-if="ordinalDesc">({{ ordinalDesc }})</small>:
</strong>
2021-01-22 14:54:24 -08:00
<span v-for="(icon, key) in config.names.countSex" :key="key" class="badge bg-light text-dark badge-big border mx-1">
2020-09-29 08:59:23 -07:00
<Icon :v="icon"/>
{{ count(version, key, ordinal) }}
</span>
</li>
</template>
</ul>
</template>
<script>
2020-10-12 06:49:33 -07:00
import nameCount from '../data/names/nameCount';
2020-09-29 08:59:23 -07:00
export default {
props: {
name: { required: true },
},
computed: {
versions() {
return this.name.split('/');
},
},
methods: {
count(name, sex, ordinal) {
const counts = nameCount[name.toUpperCase()];
if (counts === undefined) {
return 0;
}
return counts[sex][parseInt(ordinal) - 1];
},
}
};
</script>
<style lang="scss" scoped>
.badge-big {
font-size: 1em;
font-weight: normal;
}
</style>