|
|
@@ -1,5 +1,5 @@
|
|
1
|
1
|
<script setup>
|
|
2
|
|
-import { computed, onMounted } from 'vue'
|
|
|
2
|
+import { computed } from 'vue'
|
|
3
|
3
|
import { Inertia } from '@inertiajs/inertia'
|
|
4
|
4
|
|
|
5
|
5
|
const props = defineProps({
|
|
|
@@ -19,6 +19,10 @@ const props = defineProps({
|
|
19
|
19
|
type: String,
|
|
20
|
20
|
required: true,
|
|
21
|
21
|
},
|
|
|
22
|
+ param: {
|
|
|
23
|
+ type: String,
|
|
|
24
|
+ required: true,
|
|
|
25
|
+ },
|
|
22
|
26
|
})
|
|
23
|
27
|
|
|
24
|
28
|
const emit = defineEmits(['update:modelValue'])
|
|
|
@@ -29,8 +33,6 @@ const ariaDescribedbyLabel = computed(
|
|
29
|
33
|
() => props.label?.toLowerCase().replace(/\s+/g, '-') + '-error'
|
|
30
|
34
|
)
|
|
31
|
35
|
|
|
32
|
|
-let param = props.refreshData.slice(0, -1).replace('-', '_')
|
|
33
|
|
-
|
|
34
|
36
|
const removeParams = (...params) => {
|
|
35
|
37
|
const urlParams = new URLSearchParams(location.search)
|
|
36
|
38
|
|
|
|
@@ -41,7 +43,7 @@ const removeParams = (...params) => {
|
|
41
|
43
|
|
|
42
|
44
|
const onInput = (event) => {
|
|
43
|
45
|
if (event.target.value === '') {
|
|
44
|
|
- removeParams(param)
|
|
|
46
|
+ removeParams(props.param)
|
|
45
|
47
|
}
|
|
46
|
48
|
|
|
47
|
49
|
emit('update:modelValue', event.target.value)
|
|
|
@@ -50,7 +52,7 @@ const onInput = (event) => {
|
|
50
|
52
|
const onComplete = (event) => {
|
|
51
|
53
|
Inertia.reload({
|
|
52
|
54
|
data: {
|
|
53
|
|
- [param]: event.query,
|
|
|
55
|
+ [props.param]: event.query,
|
|
54
|
56
|
},
|
|
55
|
57
|
only: [props.refreshData],
|
|
56
|
58
|
})
|