diff --git a/.gitignore b/.gitignore index f798fbc2..63793e93 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,3 @@ release *.njsproj *.sln *.sw? - -# lockfile -package-lock.json -pnpm-lock.yaml -yarn.lock \ No newline at end of file diff --git a/components.d.ts b/components.d.ts index 0e75cc64..748fea56 100644 --- a/components.d.ts +++ b/components.d.ts @@ -17,8 +17,10 @@ declare module 'vue' { MyCarousel: typeof import('./src/components/MyCarousel.vue')['default'] MyCheckbox: typeof import('./src/components/MyCheckbox.vue')['default'] MyDropdown: typeof import('./src/components/MyDropdown.vue')['default'] + MySelect: typeof import('./src/components/MySelect.vue')['default'] MyTabs: typeof import('./src/components/MyTabs.vue')['default'] MyTag: typeof import('./src/components/MyTag.vue')['default'] + MyTextSwitch: typeof import('./src/components/MyTextSwitch.vue')['default'] MyTooltip: typeof import('./src/components/MyTooltip.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/package.json b/package.json index 61f4f5cf..d32101e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miXeD", - "version": "2.5.5", + "version": "2.5.6", "main": "dist-electron/main/index.js", "description": "All-in-one miHoYo game launcher", "author": "HoraceHYY ", diff --git a/src/components/LauncherPosts.vue b/src/components/LauncherPosts.vue index 6bbfa427..6909f8e5 100644 --- a/src/components/LauncherPosts.vue +++ b/src/components/LauncherPosts.vue @@ -12,7 +12,7 @@ defineProps({ }) const tabsModel = ref(0) -const keys = ['POST_TYPE_INFO', 'POST_TYPE_ACTIVITY', 'POST_TYPE_ANNOUNCE'] +const keys = ['POST_TYPE_ACTIVITY', 'POST_TYPE_ANNOUNCE', 'POST_TYPE_INFO'] const tabs = translateMultiple(keys) const openLink = (url: string) => { diff --git a/src/components/MyDropdown.vue b/src/components/MyDropdown.vue index 0a64a9e4..ad543b7a 100644 --- a/src/components/MyDropdown.vue +++ b/src/components/MyDropdown.vue @@ -15,11 +15,19 @@ const props = defineProps({ }, width: { type: String, - default: '100%', + default: 'max-content', + }, + selected: { + type: Number, + default: -1, + }, + middle: { + type: Boolean, + default: false, }, }) -defineEmits(['command']) +const emit = defineEmits(['command']) const wrapperStyles: Record = { top: { @@ -46,17 +54,24 @@ const wrapperStyles: Record = { } const showMenu = ref(false) +const wrapperRef = ref() +const dropdownRef = ref() let timer: NodeJS.Timeout | number | undefined = undefined -const transformX = computed(() => { +const transform = computed(() => { + if (!wrapperRef.value || !dropdownRef.value) return {} if (props.placement === 'top' || props.placement === 'bottom') { - return { - transform: 'translateX(-50%)', - } + return wrapperRef.value.clientWidth >= dropdownRef.value.clientWidth + ? {} + : { + transform: `translateX(-${((dropdownRef.value.clientWidth - wrapperRef.value.clientWidth) / 2).toFixed(0)}px)`, + } } else { - return { - transform: 'translateY(-50%)', - } + return wrapperRef.value.clientHeight >= dropdownRef.value.clientHeight + ? {} + : { + transform: `translateY(-${((dropdownRef.value.clientHeight - wrapperRef.value.clientHeight) / 2).toFixed(0)}px)`, + } } }) @@ -78,31 +93,37 @@ const onMouseEnter = () => { const onMouseLeave = () => { timer = setTimeout(hideMenu, 500) } + +const sendCommand = (idx: number) => { + emit('command', idx) + hideMenu() +} diff --git a/src/components/MyTextSwitch.vue b/src/components/MyTextSwitch.vue new file mode 100644 index 00000000..67341949 --- /dev/null +++ b/src/components/MyTextSwitch.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/MyTooltip.vue b/src/components/MyTooltip.vue index 4a02950c..4ac6362e 100644 --- a/src/components/MyTooltip.vue +++ b/src/components/MyTooltip.vue @@ -1,7 +1,7 @@