forked from XiaoMi/hiui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(message): 支持自定义message配置 (XiaoMi#2820)
* feat(message): 支持指定portal挂载(XiaoMi#2715) * chore(message): 生成变更记录文件 * chore(message): 增添示例(XiaoMi#2715) * fix: 修改容器类型 * feat(message): 重写自定义portal和zIndex功能(XiaoMi#2715) * feat(message): 重写示例(XiaoMi#2715) * chore: 修改示例 * chore: 修改示例 --------- Co-authored-by: xiamiao <[email protected]>
- Loading branch information
1 parent
ad02eee
commit fa61ff1
Showing
7 changed files
with
92 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
feat(message): 支持指定 portal 挂载 |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@hi-ui/message": minor | ||
"@hi-ui/toast": minor | ||
--- | ||
|
||
feat: 支持指定 portal 挂载 |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useMemo, useState } from 'react' | ||
import { createMessage } from '../src' | ||
import Button from '@hi-ui/button' | ||
|
||
/** | ||
* @title message 属性自定义 | ||
* | ||
*/ | ||
|
||
export const Custom = () => { | ||
const [container, setContainer] = useState<HTMLElement | null>(null) | ||
const message = useMemo( | ||
() => | ||
createMessage({ | ||
container, | ||
zIndex: 1000, | ||
}), | ||
[container] | ||
) | ||
return ( | ||
<> | ||
<h1>Custom</h1> | ||
<div className="message-custom__wrap"> | ||
<div | ||
ref={(e) => { | ||
setContainer(e) | ||
}} | ||
id="ddd" | ||
style={{ | ||
width: 700, | ||
height: 400, | ||
background: 'rgb(245, 247, 250)', | ||
zIndex: 1500, | ||
// Need add it | ||
position: 'relative', | ||
overflow: 'hidden', | ||
}} | ||
></div> | ||
<Button | ||
onClick={() => { | ||
message.open({ | ||
title: '欢迎使用 HiUI 组件库', | ||
type: 'success', | ||
}) | ||
}} | ||
> | ||
Toast | ||
</Button> | ||
</div> | ||
</> | ||
) | ||
} |
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