-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
106 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,56 @@ | ||
<template> | ||
<BasicDrawer v-bind="$attrs" @register="register" title="Drawer Title" width="50%"> | ||
<p class="h-20">外部传递数据: {{ receiveDrawerDataRef }}</p> | ||
<div :style="{ background: '#fff' }"> | ||
<p class="h-20">外部传递数据: {{ receiveDrawerDataRef }}</p> | ||
<BasicForm @register="registerForm" /> | ||
</div> | ||
</BasicDrawer> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { defineComponent, nextTick } from 'vue'; | ||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | ||
const schemas: FormSchema[] = [ | ||
{ | ||
field: 'field1', | ||
component: 'Input', | ||
label: '字段1', | ||
colProps: { | ||
span: 12, | ||
}, | ||
defaultValue: '111', | ||
}, | ||
{ | ||
field: 'field2', | ||
component: 'Input', | ||
label: '字段2', | ||
colProps: { | ||
span: 12, | ||
}, | ||
}, | ||
]; | ||
export default defineComponent({ | ||
components: { BasicDrawer }, | ||
components: { BasicDrawer, BasicForm }, | ||
setup() { | ||
const [register, { receiveDrawerDataRef }] = useDrawerInner(); | ||
return { register, receiveDrawerDataRef }; | ||
const [registerForm, { setFieldsValue }] = useForm({ | ||
labelWidth: 120, | ||
schemas, | ||
showActionButtonGroup: false, | ||
actionColOptions: { | ||
span: 24, | ||
}, | ||
}); | ||
const [register, { receiveDrawerDataRef }] = useDrawerInner((data) => { | ||
nextTick(() => { | ||
// 方式1 | ||
setFieldsValue({ | ||
field2: data.data, | ||
field1: data.info, | ||
}); | ||
}); | ||
}); | ||
return { register, receiveDrawerDataRef, schemas, registerForm }; | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters