feat: select item

This commit is contained in:
Fine 2023-03-28 17:59:48 +08:00
parent 9533fe56b3
commit c978da610b
3 changed files with 4 additions and 4 deletions

View File

@ -107,7 +107,7 @@ export const profileStore = defineStore({
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;
} }
const list = res.data.data.taskList; const list = res.data.data.taskList || [];
this.taskList = list; this.taskList = list;
if (!list.length) { if (!list.length) {
this.segmentList = []; this.segmentList = [];

View File

@ -24,7 +24,7 @@ limitations under the License. -->
<td <td
class="profile-td" class="profile-td"
:class="{ :class="{
selected: selectedKey == i.segmentId, selected: selectedKey === i.segmentId,
}" }"
> >
<div <div
@ -55,7 +55,7 @@ limitations under the License. -->
const { t } = useI18n(); const { t } = useI18n();
const profileStore = useProfileStore(); const profileStore = useProfileStore();
const selectedKey = ref<string>(""); const selectedKey = ref<string>(profileStore.currentSegment && profileStore.currentSegment.segmentId);
async function selectTrace(item: Trace) { async function selectTrace(item: Trace) {
profileStore.setCurrentSegment(item); profileStore.setCurrentSegment(item);

View File

@ -115,7 +115,7 @@ limitations under the License. -->
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const viewDetail = ref<boolean>(false); const viewDetail = ref<boolean>(false);
const service = ref<string>(""); const service = ref<string>("");
const selectedTask = ref<TaskListItem | Record<string, never>>({}); const selectedTask = ref<TaskListItem | Record<string, never>>(profileStore.taskList[0] || {});
const instanceLogs = ref<TaskLog | any>({}); const instanceLogs = ref<TaskLog | any>({});
async function changeTask(item: TaskListItem) { async function changeTask(item: TaskListItem) {