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