mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 19:29:04 +08:00
perf(drawer): perf drawer
This commit is contained in:
@@ -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>
|
||||
|
@@ -1,21 +1,20 @@
|
||||
<template>
|
||||
<div class="px-10">
|
||||
<Alert message="使用 useDrawer 进行抽屉操作" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openDrawerLoading">打开Drawer</a-button>
|
||||
<div class="px-10 py-4">
|
||||
<Alert message="使用 useDrawer 进行抽屉操作" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openDrawerLoading">打开Drawer</a-button>
|
||||
|
||||
<Alert message="内外同时同时显示隐藏" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openDrawer2">打开Drawer</a-button>
|
||||
<Alert message="自适应高度/显示footer" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openDrawer3">打开Drawer</a-button>
|
||||
<Alert message="内外同时同时显示隐藏" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openDrawer2">打开Drawer</a-button>
|
||||
<Alert message="自适应高度/显示footer" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openDrawer3">打开Drawer</a-button>
|
||||
|
||||
<Alert
|
||||
message="内外数据交互,外部通过 transferModalData 发送,内部通过 receiveDrawerDataRef 接收。该数据具有响应式"
|
||||
show-icon
|
||||
class="my-4"
|
||||
/>
|
||||
<a-button type="primary" class="mr-2" @click="send">打开Drawer并传递数据</a-button>
|
||||
<Alert message="详情页模式" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openDrawer5">打开详情Drawer</a-button>
|
||||
<a-button type="primary" class="my-4" @click="send">打开Drawer并传递数据</a-button>
|
||||
<Alert message="详情页模式" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openDrawer5">打开详情Drawer</a-button>
|
||||
<Drawer1 @register="register1" />
|
||||
<Drawer2 @register="register2" />
|
||||
<Drawer3 @register="register3" />
|
||||
|
@@ -1,26 +1,24 @@
|
||||
<template>
|
||||
<div class="px-10">
|
||||
<div class="px-10 py-4">
|
||||
<Alert
|
||||
message="使用 useModal 进行弹窗操作,默认可以拖动,可以通过 draggable
|
||||
参数进行控制是否可以拖动/全屏"
|
||||
show-icon
|
||||
class="my-4"
|
||||
/>
|
||||
<a-button type="primary" class="mr-2" @click="openModalLoading"
|
||||
<a-button type="primary" class="my-4" @click="openModalLoading"
|
||||
>打开弹窗 默认可以拖动/全屏</a-button
|
||||
>
|
||||
|
||||
<Alert message="内外同时同时显示隐藏" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openModal2">打开弹窗</a-button>
|
||||
<Alert message="自适应高度" show-icon class="my-4" />
|
||||
<a-button type="primary" class="mr-2" @click="openModal3">打开弹窗</a-button>
|
||||
<Alert message="内外同时同时显示隐藏" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openModal2">打开弹窗</a-button>
|
||||
<Alert message="自适应高度" show-icon />
|
||||
<a-button type="primary" class="my-4" @click="openModal3">打开弹窗</a-button>
|
||||
|
||||
<Alert
|
||||
message="内外数据交互,外部通过 transferModalData 发送,内部通过 receiveDrawerDataRef 接收。该数据具有响应式"
|
||||
show-icon
|
||||
class="my-4"
|
||||
/>
|
||||
<a-button type="primary" class="mr-2" @click="send">打开弹窗并传递数据</a-button>
|
||||
<a-button type="primary" class="my-4" @click="send">打开弹窗并传递数据</a-button>
|
||||
|
||||
<Modal1 @register="register1" />
|
||||
<Modal2 @register="register2" />
|
||||
|
Reference in New Issue
Block a user