riku
2024-04-25 743044407e35a10ff824ef18cb883ac2b66e2d12
src/views/fysp/evaluation/EvalutationEdit.vue
@@ -3,11 +3,41 @@
</template>
<script>
import evaluateApi from '@/api/fysp/evaluateApi';
import { useFetchData } from '@/composables/fetchData';
export default {
  data() {
    return {};
  setup() {
    const { loading, fetchData } = useFetchData();
    return { loading, fetchData };
  },
  methods: {}
  data() {
    return {
      evaluation: {}
    };
  },
  created() {
    // watch 路由的参数,以便再次获取数据
    this.$watch(
      () => this.$route.params,
      () => {
        this.getScore();
      },
      // 组件创建完后获取数据,
      // 此时 data 已经被 observed 了
      { immediate: true }
    );
  },
  methods: {
    // 获取评分
    getScore() {
      this.fetchData(() => {
        return evaluateApi.fetchItemEvaluation(this.$route.params.subTaskId).then((res) => {
          this.evaluation = res;
        });
      });
    }
  }
};
</script>
<style scoped></style>