重构主题切换和题目页面的切换
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import { ScreenMode } from "~/utils/constants"
|
||||
|
||||
export const screenMode = ref(ScreenMode.both)
|
||||
export const { state: screenMode, next: switchScreenMode } = useCycleList(
|
||||
Object.values(ScreenMode),
|
||||
{
|
||||
initialValue: ScreenMode.both,
|
||||
},
|
||||
)
|
||||
|
||||
export const screenSwitchLabel = computed(() => {
|
||||
if (screenMode.value === ScreenMode.both) return "题目 | 自测"
|
||||
else if (screenMode.value === ScreenMode.problem) return "仅题目"
|
||||
return "仅自测"
|
||||
})
|
||||
|
||||
export function switchScreenMode() {
|
||||
if (screenMode.value === ScreenMode.both) {
|
||||
screenMode.value = ScreenMode.problem
|
||||
return
|
||||
}
|
||||
screenMode.value += 1
|
||||
export function resetScreenMode() {
|
||||
screenMode.value = ScreenMode.both
|
||||
}
|
||||
|
||||
|
||||
export const bothAndProblem = computed(
|
||||
() =>
|
||||
screenMode.value === ScreenMode.both ||
|
||||
screenMode.value === ScreenMode.problem,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user