Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[comp: drawer]: add component drawer #227

Closed
1 task
huiyimeijiaodian opened this issue Mar 2, 2021 · 6 comments
Closed
1 task

[comp: drawer]: add component drawer #227

huiyimeijiaodian opened this issue Mar 2, 2021 · 6 comments
Assignees

Comments

@huiyimeijiaodian
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

What does the proposed API look like?

@huiyimeijiaodian
Copy link
Contributor Author

huiyimeijiaodian commented Mar 9, 2021

抽屉Drawer API

Drawer Props

参数 说明 类型 默认值 全局配置 备注
v-model:visible 是否显示Drawer boolean false -
title 标题,也可通过slot传入 string|v-slot:title - - 不传则不显示头部
footer 底部,也可通过slot传入 string|v-slot:footer - - 不传则不显示底部
closable 是否展示关闭按钮 boolean true
placement 抽屉打开方向 string 'right' - 可选值top | right | bottom | left
width 宽度 number/string '30%'|'100%' - placement为left/right时默认30%,top/bottom时默认100%
height 高度 number/string '30%'|'100%' - placement为top/bottom时默认30%,left/right时默认100%
offset 顶部/左边偏移量 number/string 0 - placement为left/right时顶部偏移量,top/bottom时左边偏移量
mask 是否展示蒙层遮罩 boolean true
maskClosable 点击蒙层是否允许关闭 boolean true
wrapClassName Drawer外层容器的类名 string -
destroyOnHide 关闭时销毁Drawer里的子元素 boolean false -
keyboard 是否支持键盘esc关闭 boolean true
beforeClose 关闭前回调,会暂停 Drawer 的关闭 function(done) - - done 用于关闭 Drawer,进行关闭二次确认

Drawer Slots

名称 说明 参数类型 备注
default Drawer 的默认内容 - -
title Drawer 标题区的内容 - slot形式优先级高于prop
footer Drawer 底部区的内容 - slot形式优先级高于prop

Drawer Emits

名称 说明 参数类型 备注
open Drawer 打开的回调 () => void
opened Drawer 打开动画结束时的回调 () => void
close Drawer 关闭的回调 () => void
closed Drawer 关闭动画结束时的回调 () => void

@huiyimeijiaodian
Copy link
Contributor Author

@danranVm @Usualminds 帮忙review 一下 API

@Usualminds
Copy link
Member

Usualminds commented Mar 9, 2021

@huiyimeijiaodian

  • 建议 widthwrapClassNameheight 支持全局配置,其他配置项是否支持全局配置也说明一下
  • 建议支持 beforeClose 事件,用于在关闭前二次确认场景
  • 除了 title 支持 slot,默认 default 也要支持 slot,如抽屉内支持表格表单场景

@danranVm
Copy link
Member

  • v-model/modelValue => v-model:visible

  • showHeader 是不是有点多余?只要有 title 的时候就渲染,没有就不渲染就行了吧

  • showClose => closable

  • width 和 height 能合并成一个吗?改个更合适的名字。?

  • showMask => mask, 同时支持一下 全局配置

  • maskClosable 也支持一下全局配置

  • destroyOnClose => destroyOnHide, 跟 [comp: popover]: add component popover #193 保持一致吧,或者你和 @LaamGinghong 协商一致叫上面名字也行

  • keyboard 也可以支持一下全局配置

  • 新增一个 footer 吧,跟 title 差不多,也支持 slot

@huiyimeijiaodian
Copy link
Contributor Author

@danranVm @Usualminds 根据以上建议进行修改。根据私下讨论,其中width和height保留,另外加上offset偏移量。例如考虑高度非100%情况。

@danranVm
Copy link
Member

closed #414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants