diff --git a/.changeset/five-ads-drum.md b/.changeset/five-ads-drum.md new file mode 100644 index 000000000..fa8fc37c0 --- /dev/null +++ b/.changeset/five-ads-drum.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +feat(modal): 新增自定义 zIndex 功能 diff --git a/.changeset/twenty-ligers-flash.md b/.changeset/twenty-ligers-flash.md new file mode 100644 index 000000000..d3e7c8247 --- /dev/null +++ b/.changeset/twenty-ligers-flash.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/modal": minor +--- + +feat: 新增自定义 zIndex 功能 diff --git a/packages/ui/modal/src/Modal.tsx b/packages/ui/modal/src/Modal.tsx index a36456cdb..af59966fd 100644 --- a/packages/ui/modal/src/Modal.tsx +++ b/packages/ui/modal/src/Modal.tsx @@ -266,6 +266,10 @@ export interface ModalProps extends HiBaseHTMLProps<'div'>, UseModalProps { * 弹出层高度设置 */ height?: React.ReactText + /** + * 自定义css展示层级 + */ + zIndex?: number /** * 是否显示蒙层 */ diff --git a/packages/ui/modal/src/use-modal.ts b/packages/ui/modal/src/use-modal.ts index ce2814178..bbdfd3eea 100644 --- a/packages/ui/modal/src/use-modal.ts +++ b/packages/ui/modal/src/use-modal.ts @@ -158,6 +158,10 @@ export const useModal = ({ style.display = 'none' } + if (Object.prototype.hasOwnProperty.call(props, 'zIndex')) { + style.zIndex = props.zIndex + } + return { role: 'dialog', 'aria-modal': true,