Skip to content

Commit

Permalink
fix:修复编译错误
Browse files Browse the repository at this point in the history
  • Loading branch information
kanoqwq committed Nov 28, 2024
1 parent ec5f85a commit e2095bc
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 103 deletions.
29 changes: 22 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/components/Favorites/Favorites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import LinkButton from './LinkButton.vue';
import AddLink from './AddLink.vue';
import useStore from '@/store/';
import type { LinkObj } from "@/types/global";
import { ref } from 'vue';
defineProps({
Expand All @@ -61,10 +62,10 @@ const editLinkShow = ref(false);
const edit = (item: LinkObj) => {
editLinkShow.value = true;
editData.value = {
id: item.id,
id: item.id as number,
imgUrl: item.imgUrl,
href: item.href,
isBlank: item.isBlank,
isBlank: item.isBlank as boolean,
};
};
const onClose = () => {
Expand Down
183 changes: 91 additions & 92 deletions src/components/Live2D/Live2DSettings.vue
Original file line number Diff line number Diff line change
@@ -1,118 +1,117 @@
<template>
<div class="L2dList">
<ul class="list" ref="scrollList">
<li
class="dark:dark-text dark:dark-btn rounded dark:hover:dark-input"
v-for="(item, index) in l2DList"
:key="item"
@click="selected(index)"
:class="{ active: item.active }">
{{ item.message }}
</li>
</ul>
<div class="flex justify-end mt-2">
<Button @click="save">保存修改</Button>
</div>
<div class="L2dList">
<ul class="list" ref="scrollList">
<li class="dark:dark-text dark:dark-btn rounded dark:hover:dark-input" v-for="(item, index) in l2DList" :key="item"
@click="selected(index)" :class="{ active: item.active }">
{{ item.message }}
</li>
</ul>
<div class="flex justify-end mt-2">
<Button @click="save">保存修改</Button>
</div>
</div>
</template>

<script lang="ts" setup>
import { ref, onMounted, nextTick } from 'vue';
import useStore from '@/store';
import { Toast } from '../Toast';
import Button from '../Button/Button.vue';
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const l2DList = ref<any>({});
const selectedIndex = ref<number>(0);
const Configs = useStore.Configs();
const scrollList = ref();
const getL2DList = async () => {
try {
const { messages } = await (
await fetch('./assets/Live2d/model_list.json')
).json();
import { ref, onMounted, nextTick } from 'vue';
import useStore from '@/store';
import { Toast } from '../Toast';
import Button from '../Button/Button.vue';
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const l2DList = ref<any>({});
const selectedIndex = ref<number>(0);
const Configs = useStore.Configs();
const scrollList = ref();
const getL2DList = async () => {
try {
const { messages } = await (
await fetch('./assets/Live2d/model_list.json')
).json();
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
l2DList.value = messages.map((item: any) => ({
message: item,
active: false,
}));
l2DList.value[Configs.modId].active = true;
} catch {
Toast({
value: '获取Live2d列表失败',
color: 'yellow',
duration: 2000,
background: '#00000099',
});
}
};
const init = () => {
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
l2DList.value = messages.map((item: any) => ({
message: item,
l2DList.value = l2DList.value.map((item: any) => ({
...item,
active: false,
}));
l2DList.value[Configs.modId].active = true;
} catch {
};
const selected = (index: number) => {
init();
selectedIndex.value = index;
l2DList.value[index].active = true;
};
const save = () => {
Configs.setModelId(selectedIndex.value);
Toast({
value: '获取Live2d列表失败',
color: 'yellow',
duration: 2000,
value: "保存成功!1秒后自动刷新页面!",
color: 'green',
duration: 1000,
background: '#00000099',
success: () => {
location.reload();
},
});
}
};
const init = () => {
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
l2DList.value = l2DList.value.map((item: any) => ({
...item,
active: false,
}));
};
};
const selected = (index: number) => {
init();
selectedIndex.value = index;
l2DList.value[index].active = true;
};
const save = () => {
Configs.setModelId(selectedIndex.value);
Toast({
value: "保存成功!1秒后自动刷新页面!",
color: 'green',
duration: 1000,
background: '#00000099',
success() {
location.reload();
},
});
};
onMounted(() => {
selectedIndex.value = Configs.modId;
getL2DList().then(() => {
nextTick(() => {
setTimeout(() => {
try {
scrollList.value.children?.[Configs.modId].scrollIntoView({
onMounted(() => {
selectedIndex.value = Configs.modId;
getL2DList().then(() => {
nextTick(() => {
setTimeout(() => {
try {
scrollList.value.children?.[Configs.modId].scrollIntoView({
behavior: 'smooth',
block: 'start',
inline: 'nearest',
});
} catch {}
}, 300);
} catch { }
}, 300);
});
});
});
});
</script>

<style scoped lang="less">
.L2dList {
.list {
overflow-y: auto;
height: 100%;
max-height: 150px;
li {
user-select: none;
box-sizing: border-box;
margin: 10px 0;
padding: 10px;
transition: all 0.2s;
background-color: #ffffff33;
&:hover {
background-color: #ffffff7e;
}
&.active {
background-color: #35e685b0 !important;
.L2dList {
.list {
overflow-y: auto;
height: 100%;
max-height: 150px;
li {
user-select: none;
box-sizing: border-box;
margin: 10px 0;
padding: 10px;
transition: all 0.2s;
background-color: #ffffff33;
&:hover {
background-color: #ffffff7e;
}
&.active {
background-color: #35e685b0 !important;
}
}
}
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/Toast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Email: [email protected]
* @Date: 2023-04-17 14:47:36
* @Last Modified by: minikano
* @Last Modified time: 2024-11-28 08:52:51
* @Last Modified time: 2024-11-28 09:18:53
* @Description: Description
*/

Expand All @@ -16,7 +16,7 @@ export interface Props {
background?: string;
color?: string;
fontWeight?: string;
success?: () => undefined
success?: () => void
}

const defaultOptions = {
Expand Down

0 comments on commit e2095bc

Please sign in to comment.