This commit is contained in:
@@ -132,13 +132,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSessionStorage } from '@vueuse/core'
|
||||
|
||||
const toast = useToast()
|
||||
const route = useRoute()
|
||||
|
||||
const contacts = [
|
||||
{
|
||||
label: 'Телефон',
|
||||
value: '+9 (967) 001-15-500',
|
||||
value: '+9 (965) 042-80-490',
|
||||
icon: 'i-lucide:phone',
|
||||
},
|
||||
{
|
||||
@@ -162,11 +164,21 @@ const services = [
|
||||
'аренда недвижимости',
|
||||
]
|
||||
|
||||
const state = useSessionStorage('contacts', {
|
||||
contacts:
|
||||
{
|
||||
name: '',
|
||||
phone: '',
|
||||
service: '',
|
||||
comment: '',
|
||||
},
|
||||
})
|
||||
|
||||
const { errors, handleSubmit, defineField } = useForm({
|
||||
initialValues: {
|
||||
name: '',
|
||||
phone: '',
|
||||
service: '',
|
||||
service: state?.value?.contacts?.service || '',
|
||||
comment: '',
|
||||
},
|
||||
validationSchema: {
|
||||
@@ -216,6 +228,11 @@ const onSubmit = handleSubmit(async (values) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => state.value, () => {
|
||||
if (state.value.contacts.service)
|
||||
service.value = state.value.contacts.service
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user