@@ -14,6 +14,7 @@ const { data, error, refetch, isSuccess, isError, isLoading } = query
|
||||
<slot v-if="isSuccess" name="default" :data="data! as R" />
|
||||
<slot v-else-if="isLoading" name="loading"><p class="text-gray-500">Загрузка данных...</p></slot>
|
||||
<slot v-else-if="isError" name="error" :error="error as E" :reload="refetch">
|
||||
Ошибка загрузки данных: {{ error && 'message' in error ? error.message : error }}
|
||||
Ошибка загрузки данных:
|
||||
{{ error && typeof error === 'object' && 'message' in error ? error.message : error }}
|
||||
</slot>
|
||||
</template>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
import { mount } from '@vue/test-utils'
|
||||
import HelloWorld from '../HelloWorld.vue'
|
||||
|
||||
describe('HelloWorld', () => {
|
||||
it('renders properly', () => {
|
||||
const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
|
||||
expect(wrapper.text()).toContain('Hello Vitest')
|
||||
})
|
||||
})
|
||||
@@ -29,7 +29,7 @@ import { type QRCodeDocument } from '@/types/DBDocumentTypes'
|
||||
import { deliveryOptions } from '@/constants/deliveryOptions'
|
||||
|
||||
const emit = defineEmits(['nextStep'])
|
||||
const model = defineModel<QRCodeDocument['messageDeliveryMethod']>()
|
||||
const model = defineModel<null | QRCodeDocument['messageDeliveryMethod']>()
|
||||
|
||||
// Локальное состояние для уведомления
|
||||
const telegramNotice = ref(false)
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { qrCodePlacements } from '@/constants/qrCodePlacements'
|
||||
const selectedPlacement = defineModel<string>()
|
||||
import type { QRCodeDocument } from '@/types/DBDocumentTypes'
|
||||
const selectedPlacement = defineModel<null | QRCodeDocument['placement']>()
|
||||
|
||||
defineEmits(['nextStep'])
|
||||
</script>
|
||||
|
||||
@@ -35,7 +35,7 @@ import { type QRCodeDocument } from '@/types/DBDocumentTypes'
|
||||
import { defaultMessages } from '@/constants/defaultMessages'
|
||||
|
||||
// Пропсы
|
||||
const props = defineProps<{ placement: QRCodeDocument['placement'] }>()
|
||||
const props = defineProps<{ placement: null | QRCodeDocument['placement'] }>()
|
||||
const messagesRef = useTemplateRef<HTMLDivElement[]>('messagesRef')
|
||||
|
||||
// Локальное хранилище сообщений
|
||||
@@ -55,7 +55,7 @@ watch(
|
||||
messages.value.length === 0 ||
|
||||
JSON.stringify(messages.value) === JSON.stringify(prevDefaultMessages)
|
||||
if (isMessagesDefault) {
|
||||
messages.value = [...(defaultMessages[newPlacement] || [])]
|
||||
messages.value = [...(defaultMessages[newPlacement!] || [])]
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
|
||||
@@ -16,7 +16,11 @@ watch(
|
||||
() => sectionRef.value && props.isNextActiveSection,
|
||||
(isNextActiveSection) => {
|
||||
if (isNextActiveSection) {
|
||||
sectionRef.value?.querySelector('input[type="text"]')?.focus()
|
||||
const input = sectionRef.value?.querySelector('input[type="text"]')
|
||||
if (input instanceof HTMLInputElement) {
|
||||
input.focus()
|
||||
}
|
||||
|
||||
sectionRef.value?.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<template #messages>
|
||||
<CreatePredefinedMessagesSection :placement="placement" v-model="messages" />
|
||||
<CreatePredefinedMessagesSection :placement v-model="messages" />
|
||||
</template>
|
||||
|
||||
<template #summary>
|
||||
|
||||
Reference in New Issue
Block a user