-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4365 from Tinhone/preview-features
[组件-自定义顶栏] feat: 为导航栏使用 `nav-link` style 的弹窗增加更多的对齐样式
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 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
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
25 changes: 25 additions & 0 deletions
25
registry/lib/components/style/custom-navbar/link-popup-content-align-style.ts
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,25 @@ | ||
import { addComponentListener } from '@/core/settings' | ||
|
||
export enum NavbarLinkPopupContentAlignStyle { | ||
Left = '左侧对齐', | ||
Center = '居中对齐', | ||
Right = '右侧对齐', | ||
} | ||
|
||
export const setupLinkPopupContentAlignStyle = () => { | ||
const map = { | ||
[NavbarLinkPopupContentAlignStyle.Left]: 'left', | ||
[NavbarLinkPopupContentAlignStyle.Center]: 'center', | ||
[NavbarLinkPopupContentAlignStyle.Right]: 'right', | ||
} | ||
addComponentListener( | ||
'customNavbar.linkPopupContentAlignStyle', | ||
(value: NavbarLinkPopupContentAlignStyle) => { | ||
document.documentElement.setAttribute( | ||
'data-navbar-link-popup-content-align-style', | ||
map[value], | ||
) | ||
}, | ||
true, | ||
) | ||
} |