<template>
  <div>mode: {{ state.setting.mode }}</div>
  <div><button @click="toggleMode">toggle mode</button></div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { store } from "@/features/mark/store";
import { ModeEnum } from "@/types";

/** 切换评分模式 */
function toggleMode() {
  store.setting.mode =
    store.setting.mode === ModeEnum.TRACK ? ModeEnum.COMMON : ModeEnum.TRACK;
  // 切换模式会清除当前任务的打分
}

export default defineComponent({
  setup() {
    console.log(store);
    return { state: store, toggleMode };
  },
  updated() {
    console.log("TestStore updated");
  },
});
</script>
