diff --git a/src/views/dashboard/demo/components/ProjectCard.vue b/src/views/dashboard/demo/components/ProjectCard.vue index 9031ec8..20a26c8 100644 --- a/src/views/dashboard/demo/components/ProjectCard.vue +++ b/src/views/dashboard/demo/components/ProjectCard.vue @@ -10,17 +10,17 @@ const props = defineProps({ default: () => {}, }, }) +const gridData = ref([]) + watch( () => props.data, (newValue, oldValue) => { // 下方信息不会打印在控制台中 console.log('a has changed', newValue, oldValue) + getNewData() }, ) -const gridData = ref([]) - -// 页面挂载时批量请求并更新数据(避免在模板中调用异步) -onMounted(async () => { +async function getNewData() { const rows = props.data.Content || [] for (const item of rows) { try { @@ -38,7 +38,29 @@ onMounted(async () => { catch (e) { } } -}) +} + + +// 页面挂载时批量请求并更新数据(避免在模板中调用异步) +// onMounted(async () => { +// const rows = props.data.Content || [] +// for (const item of rows) { +// try { +// const param = item.Point +// const res = await getExaNow(param) + +// let ifColor: boolean = false +// if (res != null) +// ifColor = res === '1' + +// gridData.value.push(Object.assign({}, item, { ifColor })) + +// console.log(gridData.value) +// } +// catch (e) { +// } +// } +// })