2021-11-20 16:10:52 +08:00
|
|
|
<template>
|
|
|
|
<div class="settings">
|
2024-12-09 19:25:06 +08:00
|
|
|
<CCProp name="refresh">
|
|
|
|
<CCSelect :value="config.refreshType" :data="refreshOptions" @change="onChangeRefreshType" style="flex: 1"> </CCSelect>
|
|
|
|
</CCProp>
|
|
|
|
<CCProp name="refresh time: " v-show="isRefreshAuto()">
|
|
|
|
<CCInputNumber style="flex: 1" :min="100" :value="config.refreshTime" @change="onChangeRefreshTime"></CCInputNumber>
|
|
|
|
<span style="margin: 0 3px">ms</span>
|
|
|
|
</CCProp>
|
2021-11-20 16:10:52 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2024-12-09 16:23:58 +08:00
|
|
|
import ccui from "@xuyanfeng/cc-ui";
|
|
|
|
import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
|
2024-12-09 19:25:06 +08:00
|
|
|
import { storeToRefs } from "pinia";
|
2024-01-09 12:02:47 +08:00
|
|
|
import { defineComponent, onMounted, ref, toRaw } from "vue";
|
2024-12-09 19:25:06 +08:00
|
|
|
import { appStore, RefreshType } from "../store";
|
|
|
|
const { CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCProp, CCColor } = ccui.components;
|
2024-01-09 12:02:47 +08:00
|
|
|
export default defineComponent({
|
|
|
|
name: "settings",
|
2024-01-09 15:33:34 +08:00
|
|
|
components: {
|
2024-12-09 19:25:06 +08:00
|
|
|
CCProp,
|
2024-01-09 15:33:34 +08:00
|
|
|
CCInput,
|
|
|
|
CCButton,
|
|
|
|
CCInputNumber,
|
|
|
|
CCSelect,
|
|
|
|
CCCheckBox,
|
|
|
|
CCColor,
|
|
|
|
},
|
2024-01-09 12:02:47 +08:00
|
|
|
props: {},
|
|
|
|
setup(props, ctx) {
|
2024-01-09 15:33:34 +08:00
|
|
|
const refreshOptions = ref<Array<Option>>([
|
2024-01-09 12:02:47 +08:00
|
|
|
{ label: "auto", value: RefreshType.Auto },
|
|
|
|
{ label: "manual", value: RefreshType.Manual },
|
|
|
|
]);
|
2024-12-09 19:25:06 +08:00
|
|
|
const { config } = storeToRefs(appStore());
|
2024-01-09 12:02:47 +08:00
|
|
|
return {
|
2024-12-09 19:25:06 +08:00
|
|
|
config,
|
2024-01-09 12:02:47 +08:00
|
|
|
refreshOptions,
|
|
|
|
isRefreshAuto() {
|
2024-12-09 19:25:06 +08:00
|
|
|
return config.value.refreshType === RefreshType.Auto;
|
2024-01-09 12:02:47 +08:00
|
|
|
},
|
2024-12-09 19:25:06 +08:00
|
|
|
onChangeRefreshType(type: RefreshType) {
|
|
|
|
const store = appStore();
|
|
|
|
store.config.refreshType = type;
|
|
|
|
store.save();
|
|
|
|
},
|
|
|
|
onChangeRefreshTime(v: number) {
|
|
|
|
const store = appStore();
|
|
|
|
store.config.refreshTime = v;
|
|
|
|
store.save();
|
2024-01-09 12:02:47 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2021-11-20 16:10:52 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
.settings {
|
2024-12-09 19:25:06 +08:00
|
|
|
color: white;
|
|
|
|
background-color: #4d4d4d;
|
2021-11-20 16:10:52 +08:00
|
|
|
}
|
|
|
|
</style>
|