diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index b06542f28..b24d38c97 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -213,9 +213,12 @@ function filter(val, options) { } function matchesSearch(val, search) { - return /^\d+$/.test(search) ? val.startsWith(search) : val.includes(search); + return isDigit(search) ? val.startsWith(search) : val.includes(search); } +function isDigit(val) { + return /^\d+$/.test(val); +} async function fetchFilter(val) { if (!$props.url) return; @@ -284,7 +287,9 @@ function nullishToTrue(value) { return value ?? true; } -const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); +function getVal(val) { + return $props.useLike ? { like: isDigit(val) ? `${val}%` : `%${val}%` } : val; +} async function onScroll({ to, direction, from, index }) { const lastIndex = myOptions.value.length - 1; diff --git a/src/components/common/VnSelectSupplier.vue b/src/components/common/VnSelectSupplier.vue index f86db4f2d..5a821456e 100644 --- a/src/components/common/VnSelectSupplier.vue +++ b/src/components/common/VnSelectSupplier.vue @@ -1,9 +1,7 @@