|
@@ -54,7 +54,13 @@ const changeRightEl = (row: any, index: number) => {
|
|
|
const testClick = () => {
|
|
|
console.log("here---in");
|
|
|
};
|
|
|
+const cacheDataMap = ref(new Map());
|
|
|
const accessoriesDataList = (index: number) => {
|
|
|
+ //对结果进行缓存 不频繁请求接口
|
|
|
+ if (cacheDataMap.value.has(index)) {
|
|
|
+ merterielBoxes.value = cacheDataMap.value.get(index);
|
|
|
+ return;
|
|
|
+ }
|
|
|
const firstObj = leftTrees?.value[index];
|
|
|
//dictLabel: "炼胶",dictSort: 1,dictValue: "1"
|
|
|
const queryAccessoriesParam = {
|
|
@@ -69,6 +75,7 @@ const accessoriesDataList = (index: number) => {
|
|
|
.then((res) => {
|
|
|
// console.log("onMounted", res.data);
|
|
|
merterielBoxes.value = res.data;
|
|
|
+ cacheDataMap.value.set(index, res.data);
|
|
|
})
|
|
|
.finally(() => {
|
|
|
loading.value = false;
|