forked from vikunja/frontend
kolaente
26a94c7e8c
Most of what's still left now is related to models not exporting visible properties for typescript, that's a problem for another day.
33 lines
733 B
Vue
33 lines
733 B
Vue
<template>
|
|
<multiselect
|
|
:placeholder="$t('namespace.search')"
|
|
@search="findNamespaces"
|
|
:search-results="namespaces"
|
|
@select="select"
|
|
label="title"
|
|
:search-delay="10"
|
|
/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import {ref, computed} from 'vue'
|
|
import {useStore} from 'vuex'
|
|
import Multiselect from '@/components/input/multiselect.vue'
|
|
import NamespaceModel from '@/models/namespace'
|
|
|
|
const emit = defineEmits(['selected'])
|
|
|
|
const query = ref('')
|
|
|
|
const store = useStore()
|
|
const namespaces = computed(() => store.getters['namespaces/searchNamespace'](query.value))
|
|
|
|
function findNamespaces(newQuery: string) {
|
|
query.value = newQuery
|
|
}
|
|
|
|
function select(namespace: NamespaceModel) {
|
|
emit('selected', namespace)
|
|
}
|
|
</script>
|