This commit is contained in:
parent
7f24b32336
commit
37859892fa
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, toRefs, computed, watch } from 'vue';
|
||||
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectCreate from 'components/common/VnSelectCreate.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -67,16 +67,19 @@ function showLabel(data) {
|
|||
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
locationFilter()
|
||||
})
|
||||
function locationFilter(search) {
|
||||
let where = { limit: 30 };
|
||||
const params = { search };
|
||||
postcodesRef.value.fetch({ where, args: params });
|
||||
let where = { search };
|
||||
postcodesRef.value.fetch({ where, limit: 30});
|
||||
}
|
||||
function handleFetch( data) {
|
||||
postcodesOptions.value = data;
|
||||
}
|
||||
async function onPostcodeCreated(){
|
||||
postcodesRef.value.fetch();
|
||||
locationFilter()
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
@ -84,7 +87,6 @@ async function onPostcodeCreated(){
|
|||
ref="postcodesRef"
|
||||
url="Postcodes/filter"
|
||||
@on-fetch="(data) =>handleFetch(data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnSelectCreate
|
||||
v-if="postcodesRef"
|
||||
|
|
Loading…
Reference in New Issue