mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-18 01:36:37 +08:00
optimize(components): optimize spacing for lang-switch dropdown options
This commit is contained in:
parent
dc674ce870
commit
fcb89883fa
@ -31,13 +31,25 @@ const tooltipContent = computed(() => {
|
|||||||
return $t('icon.lang');
|
return $t('icon.lang');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** Add bottom margin to all options except the last one for proper visual separation */
|
||||||
|
const dropdownOptions = computed(() => {
|
||||||
|
const lastIndex = props.langOptions.length - 1;
|
||||||
|
|
||||||
|
return props.langOptions.map((option, index) => ({
|
||||||
|
...option,
|
||||||
|
props: {
|
||||||
|
class: index < lastIndex ? 'mb-1' : undefined
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
function changeLang(lang: App.I18n.LangType) {
|
function changeLang(lang: App.I18n.LangType) {
|
||||||
emit('changeLang', lang);
|
emit('changeLang', lang);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NDropdown :value="lang" :options="langOptions" trigger="hover" @select="changeLang">
|
<NDropdown :value="lang" :options="dropdownOptions" trigger="hover" @select="changeLang">
|
||||||
<div>
|
<div>
|
||||||
<ButtonIcon :tooltip-content="tooltipContent" tooltip-placement="left">
|
<ButtonIcon :tooltip-content="tooltipContent" tooltip-placement="left">
|
||||||
<SvgIcon icon="heroicons:language" />
|
<SvgIcon icon="heroicons:language" />
|
||||||
|
Loading…
Reference in New Issue
Block a user