feat: 增加 resetRule 按钮

This commit is contained in:
Rewrite0
2023-06-03 11:56:55 +08:00
parent 85163cdbb4
commit 8532181e7f
3 changed files with 21 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ defineEmits(['clickAdd']);
hover:bg-primary
class="group"
:class="[active ? 'text-white bg-theme-row' : 'text-black']"
@click="i.handle"
@click="() => i.handle && i.handle()"
>
<div text-main>{{ i.label }}</div>

View File

@@ -1,11 +1,18 @@
<script lang="ts" setup>
import { Me, Pause, PlayOne, Power, Refresh } from '@icon-park/vue-next';
import {
Me,
Pause,
PlayOne,
Power,
Refresh,
Format,
} from '@icon-park/vue-next';
const search = ref('');
const show = ref(false);
const showAdd = ref(false);
const { onUpdate, offUpdate, start, pause, shutdown, restart } =
const { onUpdate, offUpdate, start, pause, shutdown, restart, resetRule } =
useProgramStore();
const { running } = storeToRefs(useProgramStore());
@@ -36,6 +43,12 @@ const items = [
},
{
id: 5,
label: 'Reset Rule',
icon: Format,
handle: resetRule,
},
{
id: 6,
label: 'Profile',
icon: Me,
handle: () => {

View File

@@ -37,6 +37,10 @@ export const useProgramStore = defineStore('program', () => {
const { execute: pause } = useApi(apiProgram.stop, opts('Pause'));
const { execute: shutdown } = useApi(apiProgram.shutdown, opts('Shutdown'));
const { execute: restart } = useApi(apiProgram.restart, opts('Restart'));
const { execute: resetRule } = useApi(
apiBangumi.resetAll,
opts('Reset Rule')
);
return {
running,
@@ -48,5 +52,6 @@ export const useProgramStore = defineStore('program', () => {
pause,
shutdown,
restart,
resetRule,
};
});