Browse Source

fix: "解決任務詳情為空是報錯"

master
xuesinan 4 years ago
parent
commit
cc590313d6
  1. 33
      src/views/detail/Test.vue

33
src/views/detail/Test.vue

@ -20,29 +20,36 @@ import MeetingManagement from 'components/tall/task/MeetingManagement.vue';
const store = useStore(); const store = useStore();
const taskDetail = computed(() => store.state.task.taskDetail); // const taskDetail = computed(() => store.state.task.taskDetail); //
const taskObj = ref({}); // const taskObj = ref({});
const label = ref(null); const label = ref(null);
const sessionTaskDetail = sessionStorage.getItem('taskDetail'); const sessionTaskDetail = sessionStorage.getItem('taskDetail');
if (sessionTaskDetail) { if (sessionTaskDetail) {
taskObj.value = JSON.parse(sessionTaskDetail); // taskObj.value = JSON.parse(sessionTaskDetail);
const taskInfo = JSON.parse(sessionTaskDetail); const taskInfo = JSON.parse(sessionTaskDetail);
taskInfo.plugins[0].forEach((item, index) => {
if (index === 0) { if (taskInfo.plugins && taskInfo.plugins.length > 0) {
label.value = item.param; taskInfo.plugins[0].forEach((item, index) => {
} if (index === 0) {
}); label.value = item.param;
}
});
}
} }
// //
watch(taskDetail, () => { watch(taskDetail, () => {
taskObj.value = taskDetail.value; // taskObj.value = taskDetail.value;
if (!taskDetail.value) return;
const taskInfo = taskDetail.value; const taskInfo = taskDetail.value;
taskInfo.plugins[0].forEach((item, index) => { if (taskInfo.plugins && taskInfo.plugins.length > 0) {
if (index === 0) { taskInfo.plugins[0].forEach((item, index) => {
label.value = item.param; if (index === 0) {
} label.value = item.param;
}); }
});
}
}); });
</script> </script>

Loading…
Cancel
Save