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.
2020-10-16 11:17:50 -07:00
|
|
|
<template>
|
2021-01-19 12:06:36 -08:00
|
|
|
<a v-if="link" :href="`/${config.nouns.route}/${config.nouns.terms.route}/${link}`" :title="alt">
|
2020-12-18 09:22:35 -08:00
|
|
|
<img :src="img" alt=""/>
|
|
|
|
{{ name }}
|
|
|
|
</a>
|
|
|
|
<span v-else :title="alt">
|
2020-12-08 15:04:42 -08:00
|
|
|
<img :src="img" alt=""/>
|
|
|
|
{{ name }}
|
2020-10-16 11:17:50 -07:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
name: { required: true },
|
2020-12-08 15:04:42 -08:00
|
|
|
alt: { required: true },
|
|
|
|
img: { required: true },
|
2020-12-21 08:35:58 -08:00
|
|
|
terms: { },
|
2020-12-18 09:22:35 -08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
link() {
|
|
|
|
if (!this.config.nouns.terms.enabled) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-12-21 08:35:58 -08:00
|
|
|
for (let term of this.terms || []) {
|
2020-12-18 09:22:35 -08:00
|
|
|
if (term.term.toLowerCase().includes(this.name.toLowerCase())) {
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
if (term.original.toLowerCase().includes(this.alt.toLowerCase())) {
|
|
|
|
return this.alt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
2020-12-08 14:14:40 -08:00
|
|
|
},
|
2020-10-16 11:17:50 -07:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
img {
|
|
|
|
height: 1rem;
|
|
|
|
}
|
|
|
|
</style>
|