refactor(Home): 重构市场组件中的数据获取逻辑
-移除了对 parentCode 的判断,保留了所有列表项 -优化了代码格式,调整了缩进和空格 - 保留了原有的功能逻辑,没有引入新的变化
This commit is contained in:
@@ -21,18 +21,18 @@ const marketList = ref([]);
|
|||||||
const active = ref(null);
|
const active = ref(null);
|
||||||
const marketInfo = ref([]);
|
const marketInfo = ref([]);
|
||||||
|
|
||||||
const getTableList = async() => {
|
const getTableList = async () => {
|
||||||
const res = await getListScene();
|
const res = await getListScene();
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
res.data.data.forEach((item) => {
|
res.data.data.forEach((item) => {
|
||||||
if (item.parentCode && item.parentCode === 1) {
|
// if (item.parentCode && item.parentCode === 1) {
|
||||||
marketList.value.push(item);
|
marketList.value.push(item);
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
getMarketInfo(marketList.value[0]);
|
getMarketInfo(marketList.value[0]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const getMarketInfo = async(item) => {
|
const getMarketInfo = async (item) => {
|
||||||
const data = marketList.value.filter((market, index) => item === index)[0];
|
const data = marketList.value.filter((market, index) => item === index)[0];
|
||||||
if (data) {
|
if (data) {
|
||||||
const params = {
|
const params = {
|
||||||
|
|||||||
Reference in New Issue
Block a user