mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 23:19:37 +00:00
32 lines
1.0 KiB
Vue
32 lines
1.0 KiB
Vue
<script lang="ts" setup>
|
|
import VeeForm from '@/components/VeeForm.vue'
|
|
import TextUploadInputTextView from './TextUploadInputTextView.vue'
|
|
import ResultIndexView from '@/components/Result/ResultIndexView.vue'
|
|
|
|
const textStepList = [
|
|
{ component: TextUploadInputTextView, key: 'input' },
|
|
{ component: ResultIndexView, key: 'result' },
|
|
]
|
|
|
|
const step = ref('input')
|
|
|
|
const renderComponent = computed(() => {
|
|
return textStepList.find((item) => item.key === step.value)?.component
|
|
})
|
|
const formRef = ref<InstanceType<typeof VeeForm>>()
|
|
watch(() => step.value, (newVal) => {
|
|
if (newVal === 'input') {
|
|
formRef.value?.form?.resetForm()
|
|
// formRef.value?.form?.setValues({ file: null })
|
|
}
|
|
})
|
|
</script>
|
|
<template>
|
|
<VeeForm ref="formRef" v-slot="{ values }" :keepValues="true">
|
|
<div class="rounded-xl p-5 bg-white/50 backdrop-blur-xl w-full lg:w-200">
|
|
<component :is="renderComponent" :data="values" @change="(key: string) => {
|
|
step = key
|
|
}" />
|
|
</div>
|
|
</VeeForm>
|
|
</template> |