arco-design / arco-design-vue

A Vue.js 3 UI Library based on Arco Design
https://arco.design/vue
MIT License
2.67k stars 518 forks source link

When the DescriptionsItem component is used as a nested element, the Descriptions component does not render correctly #2587

Open longshihui opened 1 year ago

longshihui commented 1 year ago

Basic Info

What is expected?

The descriptions component is render correctly.

Steps to reproduce

  1. pick description-item component to another component
  2. use new components insert to the descriptions component slot.
<template>
  <a-descriptions title="Incorrect" :column="{ xs: 1, md: 3, lg: 4 }">
      <SubDesc />
  </a-descriptions>
</template>

<script>
import { DescriptionsItem, Tag } from "@arco-design/web-vue";
import { h } from "vue";

const SubDesc = {
  setup() {
    const data = [
      {
        label: "Name",
        value: "Socrates",
      },
      {
        label: "Mobile",
        value: "123-1234-1234",
      },
      {
        label: "Residence",
        value: "Beijing",
      },
      {
        label: "Hometown",
        value: "Beijing",
      },
      {
        label: "Address",
        value: "Yingdu Building, Zhichun Road, Beijing",
      },
    ];

    return () => {
      return data.map((item) => {
        return h(
          DescriptionsItem,
          {
            label: item.label,
          },
          h(Tag, item.value)
        );
      });
    };
  },
};

export default {
  components: {
    SubDesc,
  },
  setup() {
  },
};
</script>
pzgz commented 1 year ago

descriptions里问题比较大,这问题存在很久了,我目前的解决方法就是这样:https://github.com/arco-design/arco-design-vue/issues/1685#issuecomment-1387699444

简单说,东西没准备好之前不显示descriptions