mirror of
https://codeberg.org/HPCesia/AstralHalo.git
synced 2025-04-08 17:34:27 +08:00
feat: blank config for nav button
This commit is contained in:
parent
01a23952ac
commit
e4c27947d7
@ -43,7 +43,11 @@ if (!title) title = 'Astral Halo';
|
||||
<ul class="menu bg-base-200/50 absolute -translate-x-[50%] rounded-xl shadow backdrop-blur-md">
|
||||
{item.items.map((subItem) => (
|
||||
<Button
|
||||
{...('href' in subItem && subItem.href && { href: subItem.href })}
|
||||
{...('href' in subItem &&
|
||||
subItem.href && {
|
||||
href: subItem.href,
|
||||
target: subItem.blank ? '_blank' : undefined,
|
||||
})}
|
||||
title={i18n(subItem.text)}
|
||||
class="btn-ghost btn-primary rounded-field"
|
||||
>
|
||||
@ -57,7 +61,11 @@ if (!title) title = 'Astral Halo';
|
||||
} else {
|
||||
return (
|
||||
<Button
|
||||
{...('href' in item && item.href && { href: item.href })}
|
||||
{...('href' in item &&
|
||||
item.href && {
|
||||
href: item.href,
|
||||
target: item.blank ? '_blank' : undefined,
|
||||
})}
|
||||
title={i18n(item.text)}
|
||||
class="btn-ghost join-item btn-primary"
|
||||
>
|
||||
@ -132,7 +140,11 @@ if (!title) title = 'Astral Halo';
|
||||
{item.items.map((subItem) => (
|
||||
<li>
|
||||
<Button
|
||||
{...('href' in subItem && subItem.href && { href: subItem.href })}
|
||||
{...('href' in subItem &&
|
||||
subItem.href && {
|
||||
href: subItem.href,
|
||||
target: subItem.blank ? '_blank' : undefined,
|
||||
})}
|
||||
title={i18n(subItem.text)}
|
||||
class="btn-ghost"
|
||||
>
|
||||
@ -148,7 +160,11 @@ if (!title) title = 'Astral Halo';
|
||||
return (
|
||||
<li>
|
||||
<Button
|
||||
{...('href' in item && item.href && { href: item.href })}
|
||||
{...('href' in item &&
|
||||
item.href && {
|
||||
href: item.href,
|
||||
target: item.blank ? '_blank' : undefined,
|
||||
})}
|
||||
title={i18n(item.text)}
|
||||
class="btn-ghost"
|
||||
>
|
||||
|
@ -46,7 +46,7 @@ import TocButton from './widgets/SideToolBar/TocButton.vue';
|
||||
const { icon, text } = item;
|
||||
if ('href' in item)
|
||||
return (
|
||||
<Button href={item.href} title={text}>
|
||||
<Button href={item.href} target={item.blank ? '_blank' : undefined} title={text}>
|
||||
<Icon name={icon} slot="icon" />
|
||||
</Button>
|
||||
);
|
||||
|
@ -106,6 +106,7 @@ export const navbarConfig: NavbarConfig = {
|
||||
icon: 'material-symbols:rss-feed-rounded',
|
||||
text: I18nKey.subscribe,
|
||||
href: '/rss.xml',
|
||||
blank: true,
|
||||
},
|
||||
{
|
||||
icon: 'material-symbols:casino',
|
||||
|
@ -32,6 +32,14 @@ export type ButtonSubConfig<T extends string> = T extends 'text'
|
||||
* 按钮的 URL。
|
||||
*/
|
||||
href?: string;
|
||||
/**
|
||||
* Whether to open the link in a new tab.
|
||||
*
|
||||
* 是否在新标签页中打开链接。
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
blank?: boolean;
|
||||
}
|
||||
| {
|
||||
/**
|
||||
@ -69,6 +77,14 @@ export type ButtonSubConfig<T extends string> = T extends 'text'
|
||||
* 按钮的 URL。
|
||||
*/
|
||||
href?: string;
|
||||
/**
|
||||
* Whether to open the link in a new tab.
|
||||
*
|
||||
* 是否在新标签页中打开链接。
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
blank?: boolean;
|
||||
}
|
||||
| {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user