generated from electron-vite/electron-vite-vue
-
Notifications
You must be signed in to change notification settings - Fork 15
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 #74 from HoraceHuang-ui/horace_dev
2.5.6
- Loading branch information
Showing
25 changed files
with
409 additions
and
187 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,3 @@ release | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# lockfile | ||
package-lock.json | ||
pnpm-lock.yaml | ||
yarn.lock |
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,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 <[email protected]>", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script setup lang="ts"> | ||
import { PropType } from 'vue' | ||
const props = defineProps({ | ||
items: { | ||
type: Array as PropType<string[]>, | ||
required: true, | ||
}, | ||
selectorClass: { | ||
type: String, | ||
}, | ||
selectorStyle: { | ||
type: Object as PropType<Record<string, any>>, | ||
}, | ||
itemClass: { | ||
type: String, | ||
}, | ||
modelValue: { | ||
type: Number, | ||
default: -1, | ||
}, | ||
middle: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}) | ||
const emit = defineEmits(['update:modelValue', 'change']) | ||
const selectionChange = (idx: number) => { | ||
emit('update:modelValue', idx) | ||
if (idx === props.modelValue) { | ||
return | ||
} | ||
emit('change', idx) | ||
} | ||
</script> | ||
|
||
<template> | ||
<MyDropdown | ||
:items="items" | ||
:item-class="itemClass" | ||
:selected="modelValue" | ||
:middle="middle" | ||
@command="selectionChange" | ||
> | ||
<div | ||
class="w-fit rounded-full py-1 px-3 flex flex-row justify-between" | ||
:class="selectorClass" | ||
:style="selectorStyle" | ||
> | ||
<div class="mr-4">{{ modelValue == -1 ? '' : items[modelValue] }}</div> | ||
<i class="bi bi-chevron-down" /> | ||
</div> | ||
</MyDropdown> | ||
</template> | ||
|
||
<style scoped></style> |
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,77 @@ | ||
<script setup lang="ts"> | ||
import { computed, ref, watch } from 'vue' | ||
const props = defineProps({ | ||
modelValue: { | ||
type: Boolean, | ||
}, | ||
leftText: { | ||
type: String, | ||
required: true, | ||
}, | ||
rightText: { | ||
type: String, | ||
required: true, | ||
}, | ||
}) | ||
const emit = defineEmits(['update:modelValue']) | ||
const max = (a: number, b: number) => (a > b ? a : b) | ||
const leftRef = ref<HTMLElement>() | ||
const rightRef = ref<HTMLElement>() | ||
const unitWidth = computed(() => { | ||
if (!leftRef.value || !rightRef.value) return 0 | ||
return max(leftRef.value.scrollWidth, rightRef.value.scrollWidth) + 10 | ||
}) | ||
const sliderTransform = computed(() => { | ||
return { | ||
transform: props.modelValue | ||
? 'translateX(0)' | ||
: `translateX(calc(${unitWidth.value}px + 5px))`, | ||
} | ||
}) | ||
watch(unitWidth, () => { | ||
console.log('width: ' + unitWidth.value.toString()) | ||
}) | ||
const switchState = () => { | ||
console.log('width: ' + unitWidth.value.toString()) | ||
emit('update:modelValue', !props.modelValue) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="ml-3 rounded-full flex flex-row py-1 bg-white relative cursor-pointer" | ||
:style="{ width: `calc(${unitWidth}px * 2 + 10px)` }" | ||
@click="switchState" | ||
> | ||
<div | ||
class="rounded-full bg-blue-500 absolute top-0 bottom-0 z-0 transition-all" | ||
:style="{ width: `calc(${unitWidth}px + 5px)`, ...sliderTransform }" | ||
></div> | ||
<div | ||
ref="leftRef" | ||
class="rounded-full absolute z-10 left-0 text-center transition-all text-nowrap" | ||
:class="{ 'text-white': modelValue }" | ||
:style="{ width: `${unitWidth}px` }" | ||
> | ||
{{ leftText }} | ||
</div> | ||
<div | ||
ref="rightRef" | ||
class="rounded-full absolute z-10 right-0 text-center transition-all text-nowrap" | ||
:class="{ 'text-white': !modelValue }" | ||
:style="{ width: `${unitWidth}px` }" | ||
> | ||
{{ rightText }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped></style> |
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
Oops, something went wrong.