<template>
  <view>
    <view v-for="item in sonTask" :key="item.detailId">
      <span class="text-xs text-gray-500">{{ item.name }}</span>
    </view>
  </view>
</template>

<script>
export default {
  name: 'p-subtasks',
  props: {
    task: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return { sonTask: [] };
  },

  created() {
    this.getSonTask();
  },

  methods: {
    async getSonTask() {
      try {
        const data = await this.$u.api.findSonTask({ detailId: this.task.detailId });
        this.sonTask = data;
      } catch (error) {
        console.error('p-subtasks.vue getSonTask error: ', error);
      }
    },
  },
};
</script>

<style></style>
