You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ygdc/assets/js/components/squareElem.js

23 lines
633 B

2 months ago
import { computed, ref } from "vue";
import { getId } from "../handlers.js";
const html = (v) => { return v[0] };
export default {
props: ["icon", "text", "withshortkey"],
setup(props) {
const el = ref(null);
const suffix = computed(() => props.withshortkey ? ` (${getId(el.value)})`: "");
return { suffix, el }
},
template: html`
<div class="square element" ref="el">
<div class="icon">
<inject-svg v-if="icon.endsWith('.svg')" :src="icon"></inject-svg>
<img v-if="!icon.endsWith('.svg')" :src="icon">
</div>
<h2>{{ text }}{{ suffix }}</h2>
</div>
`
}