fix: watcher in listSearch (#1992)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1992 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
f91424f693
commit
b4aa65018c
1 changed files with 16 additions and 8 deletions
|
@ -17,18 +17,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {reactive, ref, watchEffect} from 'vue'
|
import {reactive, ref, watch} from 'vue'
|
||||||
|
import type {PropType} from 'vue'
|
||||||
import {useStore} from 'vuex'
|
import {useStore} from 'vuex'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
import ListModel from '@/models/list'
|
import ListModel from '@/models/list'
|
||||||
import Multiselect from '@/components/input/multiselect.vue'
|
import Multiselect from '@/components/input/multiselect.vue'
|
||||||
|
|
||||||
const store = useStore()
|
|
||||||
const {t} = useI18n()
|
|
||||||
|
|
||||||
const list = reactive(new ListModel())
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
|
type: Object as PropType<ListModel>,
|
||||||
validator(value) {
|
validator(value) {
|
||||||
return value instanceof ListModel
|
return value instanceof ListModel
|
||||||
},
|
},
|
||||||
|
@ -37,9 +35,19 @@ const props = defineProps({
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
watchEffect(() => {
|
const store = useStore()
|
||||||
Object.assign(list, props.modelValue)
|
const {t} = useI18n()
|
||||||
})
|
|
||||||
|
const list = reactive<ListModel>(new ListModel())
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(newList) => Object.assign(list, newList),
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
const foundLists = ref([])
|
const foundLists = ref([])
|
||||||
function findLists(query: string) {
|
function findLists(query: string) {
|
||||||
|
|
Loading…
Reference in a new issue