ygdc/assets/js/components/plainElem.js

16 lines
457 B

import { computed, ref } from "vue";
import { getId } from "../handlers.js";
const html = (v) => { return v[0] };
export default {
props: ['text', 'withshortkey', 'autofocus'],
setup(props) {
const el = ref(null);
const suffix = computed(() => props.withshortkey ? ` (${getId(el.value)})`: "");
return { suffix, el }
},
template: html`
<div class="plain element" ref="el" v-autofocus="autofocus">{{ text }}{{ suffix }}</div>
`
}