wip(VForm): VForm coding

This commit is contained in:
陈凯龙
2021-12-14 17:42:43 +08:00
parent 7528fe6da6
commit d7d0ada558
11 changed files with 221 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, unref } from 'vue'
import { ref, onMounted, unref, reactive } from 'vue'
import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
// import en from 'element-plus/lib/locale/lang/en'
@@ -9,21 +9,29 @@ const formRef = ref<ComponentRef<typeof VFrom> & VFormExpose>()
onMounted(() => {
const form = unref(formRef.value)
console.log(form?.$el)
const schema: VFormSchema = [
{
field: '1',
colProps: {}
}
]
console.log(schema)
})
const schema = reactive<VFormSchema[]>([
{
field: 'field1',
label: '字段1',
component: 'Input'
}
])
// setTimeout(() => {
// schema.push({
// field: '2'
// })
// }, 3000)
</script>
<template>
<ElConfigProvider :locale="zhCn">
<VFrom ref="formRef" />
<Component :is="VFrom" />
<!-- <VFrom ref="formRef" is-custom>
<template #default> hahahah </template>
</VFrom> -->
<VFrom :schema="schema" />
<!-- <VFrom :is-col="false" :schema="schema" /> -->
<!-- <Component :is="VFrom" /> -->
<!-- <RouterView class="app" /> -->
</ElConfigProvider>
</template>