-
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.
- Loading branch information
Showing
6 changed files
with
191 additions
and
141 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 下拉菜单 | ||
<script setup> | ||
import { computed } from "vue"; | ||
const props = defineProps({ | ||
// 下拉的列表 | ||
list: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
// 标题 | ||
title: { type: String, default: "" }, | ||
// 弹框的位置 | ||
position: { type: String, default: "end" }, | ||
// 打开方式 | ||
openType: { type: String, default: "click" }, | ||
}); | ||
// 计算属性 | ||
const hover = computed(() => props.openType === "hover"); | ||
</script> | ||
<template> | ||
<!-- <div class="dropdown dropdown-end" :class="{ 'dropdown-open': show }" @click="tabState"> --> | ||
<div class="dropdown dropdown-end" :class="{ 'dropdown-hover': hover }"> | ||
<slot name="title" tabindex="0"></slot> | ||
<div v-if="title" tabindex="0" role="button" class="btn m-1">{{ title }}</div> | ||
<ul | ||
tabindex="0" | ||
class="dropdown-content bg-base-200 text-base-content rounded-box top-px mt-16 max-h-[calc(100vh-10rem)] w-56 overflow-y-auto border border-white/5 shadow-2xl outline outline-1 outline-black/5 menu menu-sm gap-1" | ||
> | ||
<li v-for="(item, index) in list" :key="index"> | ||
<slot :item="item"></slot> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -1,42 +1,38 @@ | ||
<script setup> | ||
import { useI18n } from 'vue-i18n'; | ||
import { useI18n } from "vue-i18n"; | ||
import DropdownView from "@/components/DropdownView.vue"; | ||
const { t, locale } = useI18n(); | ||
const locList = [ | ||
{ | ||
code: 'EN', | ||
lang: 'English', | ||
loc: 'en', | ||
code: "EN", | ||
lang: "English", | ||
loc: "en", | ||
}, | ||
{ | ||
code: 'ZH', | ||
lang: '中文', | ||
loc: 'zh-CN', | ||
code: "ZH", | ||
lang: "中文", | ||
loc: "zh-CN", | ||
}, | ||
]; | ||
const setLanguage = (lang) => { | ||
locale.value = lang; | ||
}; | ||
</script> | ||
<template> | ||
<div class="dropdown dropdown-end"> | ||
<div tabindex="0" role="button" class="btn m-1">{{ t('nav-bar.tab-lang') }}</div> | ||
<div | ||
tabindex="0" | ||
class="dropdown-content bg-base-200 text-base-content rounded-box top-px mt-16 max-h-[calc(100vh-10rem)] w-56 overflow-y-auto border border-white/5 shadow-2xl outline outline-1 outline-black/5" | ||
> | ||
<ul class="menu menu-sm gap-1"> | ||
<li v-for="(item, index) in locList" :key="index"> | ||
<button class="btn glass flex justify-between w-full" @click="setLanguage(item.loc)"> | ||
<span | ||
class="badge badge-sm badge-outline !pl-1.5 !pr-1 pt-px font-mono !text-[.6rem] font-bold tracking-widest opacity-50" | ||
:class="{ 'badge-primary': item.loc === locale }" | ||
> | ||
{{ item.code }} | ||
</span> | ||
<span class="font-[sans-serif]">{{ item.lang }}</span> | ||
</button> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<DropdownView :list="locList" :title="t('nav-bar.tab-lang')"> | ||
<template #default="{ item }"> | ||
<button | ||
class="btn glass flex justify-between w-full" | ||
@click="setLanguage(item.loc)" | ||
> | ||
<span | ||
class="badge badge-sm badge-outline !pl-1.5 !pr-1 pt-px font-mono !text-[.6rem] font-bold tracking-widest opacity-50" | ||
:class="{ 'badge-primary': item.loc === locale }" | ||
> | ||
{{ item.code }} | ||
</span> | ||
<span class="font-[sans-serif]">{{ item.lang }}</span> | ||
</button> | ||
</template> | ||
</DropdownView> | ||
</template> |
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
Oops, something went wrong.
2075090
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
leelaa-admin – ./
leelaa-admin-leelaas-projects.vercel.app
leelaa-admin-git-master-leelaas-projects.vercel.app
leelaa-admin.vercel.app