Commit 23eba274560a294f50e4b7c529ae8a63a266fb87

Authored by John Niang
Committed by GitHub
1 parent c81d48e7

fix(description): not rendering while show method return false (#253)

* fix(description): not rendering while show method return false

fix #252

* Move data desctruction outside loop
src/components/Description/src/index.tsx
@@ -83,10 +83,9 @@ export default defineComponent({ @@ -83,10 +83,9 @@ export default defineComponent({
83 } 83 }
84 84
85 function renderItem() { 85 function renderItem() {
86 - const { schema } = unref(getProps); 86 + const { schema, data } = unref(getProps);
87 return unref(schema).map((item) => { 87 return unref(schema).map((item) => {
88 const { render, field, span, show, contentMinWidth } = item; 88 const { render, field, span, show, contentMinWidth } = item;
89 - const { data } = unref(getProps) as DescOptions;  
90 89
91 if (show && isFunction(show) && !show(data)) { 90 if (show && isFunction(show) && !show(data)) {
92 return null; 91 return null;
@@ -112,7 +111,8 @@ export default defineComponent({ @@ -112,7 +111,8 @@ export default defineComponent({
112 }} 111 }}
113 </Descriptions.Item> 112 </Descriptions.Item>
114 ); 113 );
115 - }); 114 + })
  115 + .filter((item) => !!item);
116 } 116 }
117 117
118 const renderDesc = () => { 118 const renderDesc = () => {