2021-12-08 10:47:33 +08:00
|
|
|
<script setup lang="ts">
|
2021-12-14 17:42:43 +08:00
|
|
|
import { ref, onMounted, unref, reactive } from 'vue'
|
2021-12-11 11:46:10 +08:00
|
|
|
import { ElConfigProvider } from 'element-plus'
|
|
|
|
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
|
|
|
// import en from 'element-plus/lib/locale/lang/en'
|
2021-12-13 16:55:58 +08:00
|
|
|
import { VFrom, VFormExpose } from '@/components/Form'
|
|
|
|
const formRef = ref<ComponentRef<typeof VFrom> & VFormExpose>()
|
2021-12-15 17:16:53 +08:00
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
const { t } = useI18n()
|
2021-12-11 20:50:05 +08:00
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
const form = unref(formRef.value)
|
2021-12-15 17:16:53 +08:00
|
|
|
console.log(form)
|
2021-12-11 20:50:05 +08:00
|
|
|
})
|
2021-12-14 17:42:43 +08:00
|
|
|
const schema = reactive<VFormSchema[]>([
|
|
|
|
{
|
|
|
|
field: 'field1',
|
2021-12-15 21:26:14 +08:00
|
|
|
component: 'Divider',
|
|
|
|
componentProps: {
|
|
|
|
text: 'input示例'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'field2',
|
2021-12-14 17:42:43 +08:00
|
|
|
label: '字段1',
|
|
|
|
component: 'Input'
|
|
|
|
}
|
|
|
|
])
|
2021-12-08 10:47:33 +08:00
|
|
|
</script>
|
|
|
|
|
2021-12-11 11:46:10 +08:00
|
|
|
<template>
|
|
|
|
<ElConfigProvider :locale="zhCn">
|
2021-12-14 17:42:43 +08:00
|
|
|
<!-- <VFrom ref="formRef" is-custom>
|
|
|
|
<template #default> hahahah </template>
|
|
|
|
</VFrom> -->
|
|
|
|
<VFrom :schema="schema" />
|
|
|
|
<!-- <VFrom :is-col="false" :schema="schema" /> -->
|
|
|
|
<!-- <Component :is="VFrom" /> -->
|
2021-12-11 20:50:05 +08:00
|
|
|
<!-- <RouterView class="app" /> -->
|
2021-12-15 17:16:53 +08:00
|
|
|
<div>{{ t('common.inputText') }}</div>
|
2021-12-11 11:46:10 +08:00
|
|
|
</ElConfigProvider>
|
|
|
|
</template>
|