hookehuyr

✨ feat: 新增表单封面和表单描述

<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-06 14:41:04
* @LastEditTime: 2022-09-06 15:05:23
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
<template>
<van-image width="100%" height="200" src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg" />
<div style="padding: 1rem;">表单描述</div>
<div style="padding: 1rem;">
<van-image v-if="table_cover" width="100%" height="200" :src="table_cover" />
<div v-if="table_title" class="table-title">{{ table_title }}</div>
<div class="table-box">
<van-form @submit="onSubmit">
<van-cell-group>
<component v-for="(item, index) in mockData" :key="index" :is="item.component" :item="item" />
......@@ -20,14 +20,18 @@
</div>
</van-form>
</div>
</template>
<script setup>
import { createComponentType } from '@/hooks/useComponentType'
const table_cover = ref('');
const table_title = ref('');
const mockData = ref([]);
onMounted(() => {
table_cover.value = 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg'
table_title.value = '这是一个表单的描述'
mockData.value = [{
key: 'phone',
value: '',
......@@ -165,4 +169,10 @@ const onSubmit = (values) => {
</script>
<style lang="less" scoped>
.table-title {
padding: 1rem;
}
.table-box {
padding: 1rem;
}
</style>
......