feat: drawer 组件封装

This commit is contained in:
xuziqiang
2024-05-29 13:58:08 +08:00
parent c9f8148dc3
commit f7ebb4bd60
3 changed files with 39 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
<!-- @format -->
<template>
<a-drawer v-bind="getBindValue">
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
<slot :name="item" v-bind="data || {}"></slot>
</template>
<template #footer>
<a-button>取消</a-button>
</template>
</a-drawer>
</template>
<script lang="ts">
import { computed, defineComponent, toRefs } from 'vue';
import { drawerProps } from 'ant-design-vue/es/drawer';
export default defineComponent({
name: 'NsDrawer',
props: {
...drawerProps(),
},
setup(props, { attrs, emit, slots }) {
console.log(props, slots);
const getBindValue = computed(() => ({
...attrs,
...props,
}));
return { getBindValue };
},
});
</script>
<style lang="less" scoped></style>