riku
2024-10-30 d4e7c11e06b643c9353444c839cec40c25945219
src/components/SideList.vue
@@ -11,6 +11,7 @@
    empty-text="暂无记录"
  >
    <template #default="{ node, data }">
      <slot :node="node" :data="data">
      <div
        :class="
          data.selected
@@ -29,6 +30,7 @@
        /></el-icon>
        <div>{{ node.label }}</div>
      </div>
      </slot>
    </template>
  </el-tree>
</template>
@@ -43,20 +45,20 @@
          type: 0,
          title: 'title',
          categoly: '2022-10-10',
          data: {},
          data: {}
        }
      ]
        },
      ],
    },
    loading: Boolean,
    loading: Boolean
  },
  emits: ['itemClick'],
  data() {
    return {
      defaultProps: {
        children: 'children',
        label: 'title',
        label: 'title'
      },
      isLoading: this.loading,
      isLoading: this.loading
    };
  },
  computed: {
@@ -75,7 +77,7 @@
      for (const [key, value] of itemMap) {
        const i = {
          title: key,
          children: [],
          children: []
        };
        value.forEach((v) => {
          i.children.push(v);
@@ -92,11 +94,11 @@
        }
      });
      return list;
    },
    }
  },
  watch: {
    loading(nValue) {
      this.isLoading = nValue
      this.isLoading = nValue;
    },
    //当数据第一次更新时
    dataList(nValue) {
@@ -117,7 +119,7 @@
        }
        this.isLoading = false;
      }
    },
    }
  },
  methods: {
    handleNodeClick(data) {
@@ -131,8 +133,8 @@
      if (data.children == undefined) {
        this.$emit('itemClick', data);
      }
    },
  },
    }
  }
};
</script>