12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <template>
- <div class="w-full h-full flex flex-col">
- <div class="flex-1 overflow-y-auto">
- <CustomerForm ref="formFormRef" :formJson="formJson" :formValue="formVal"></CustomerForm>
- </div>
- <div class="mar-20px ">
- <van-button type="primary" @click="onSubmit" class="w-full">
- {{ Object.keys(formVal).length > 0 ? '确定修改' : '确定添加' }}
- </van-button>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, onActivated } from 'vue';
- import { useLifecycle } from '@hooks/useCommon.js';
- import CustomerForm from '@components/common/formForm/formView.vue'
- const props = defineProps({
- formJson: { required: true },
- formValue: { required: true },
- });
- const formFormRef = ref(null)
- const formVal = ref({})
- function onSubmit() {
- formFormRef.value.getJsonData().then((res) => {
- console.log('表单验证成功', res, JSON.stringify(res));
- })
- }
- useLifecycle({
- load: () => {
- formVal.value = props.formValue
- },
- init: () => {
- formVal.value = props.formValue
- }
- });
- onActivated(() => {
-
- })
- </script>
- <style lang='scss' scoped>
- /* 样式代码 */
- </style>
|