Browse Source

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

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

13
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);
if (taskInfo.plugins && taskInfo.plugins.length > 0) {
taskInfo.plugins[0].forEach((item, index) => { taskInfo.plugins[0].forEach((item, index) => {
if (index === 0) { if (index === 0) {
label.value = item.param; 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;
if (taskInfo.plugins && taskInfo.plugins.length > 0) {
taskInfo.plugins[0].forEach((item, index) => { taskInfo.plugins[0].forEach((item, index) => {
if (index === 0) { if (index === 0) {
label.value = item.param; label.value = item.param;
} }
}); });
}
}); });
</script> </script>

Loading…
Cancel
Save