ygdc/assets/js/components/select.js

29 lines
821 B

3 months ago
import { nextTick, reactive, ref, computed, onMounted, onUnmounted } from "vue";
import { handleActive, ArrowVerticalKeyHandler, ArrowHorizontalKeyHandler, NumberKeyHandler } from "../handlers.js";
const html = (v) => { return v[0] };
export default {
3 months ago
props: ['options', 'title', 'stack', 'active', 'input'],
3 months ago
setup(props, context) {
handleActive(props, [ArrowVerticalKeyHandler]);
const children = computed(() => {
3 months ago
return props.options.map((o) => {
3 months ago
return {
3 months ago
component: "d-plainElem",
props: {"text": o},
3 months ago
onClick: () => {
3 months ago
context.emit('resolve', o);
3 months ago
}
}
})
});
return { children }
},
template: html`
<div class="playerselect">
3 months ago
<d-list :title="title" :withshortkey="true" :elements="children"/>
3 months ago
</div>
`
}