add: completed register view
This commit is contained in:
61
src/components/ui/Segments.vue
Normal file
61
src/components/ui/Segments.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import VueMultiselect from 'vue-multiselect'
|
||||
import { searchcategories } from '../../services/public';
|
||||
|
||||
const options = ref([]);
|
||||
const isLoading = ref(false);
|
||||
|
||||
// defineProps(['selectedCategory']);
|
||||
defineProps({
|
||||
selectedCategory: {
|
||||
type: Array
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
defineEmits(['update:selectedCategory', 'clear-option'])
|
||||
|
||||
const searchCategory = async(query) => {
|
||||
isLoading.value = true;
|
||||
const resp = await searchcategories(query);
|
||||
options.value = resp;
|
||||
isLoading.value = false;
|
||||
// truckTypes.value = resp;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VueMultiselect
|
||||
:value="selectedCategory"
|
||||
@input="$event => $emit('update:selectedCategory', $event.target.value)"
|
||||
:options="options"
|
||||
:multiple="multiple"
|
||||
:searchable="true"
|
||||
:loading="isLoading"
|
||||
:close-on-select="true"
|
||||
@search-change="searchCategory"
|
||||
@remove="$emit('clear-option')"
|
||||
placeholder="Busca por segmento"
|
||||
label="name"
|
||||
track-by="name"
|
||||
selectLabel="Presione para seleccionar"
|
||||
selectedLabel="Selecionado"
|
||||
deselectLabel="Presione para remover selecion"
|
||||
>
|
||||
<template #noResult>
|
||||
Oops! No se encontro coincidencias.
|
||||
</template>
|
||||
<template #noOptions>
|
||||
Lista vacia.
|
||||
</template>
|
||||
</VueMultiselect>
|
||||
</template>
|
||||
|
||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user