浏览代码

fix: 修改table计算未包含no

xyh 2 年之前
父节点
当前提交
408a43a2a6
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      src/components/table/index.tsx

+ 6 - 5
src/components/table/index.tsx

@@ -30,11 +30,6 @@ export default defineComponent({
     },
   },
   setup(props) {
-    const tableWidth = computed(function() {
-      return props.columns.reduce(function(prev, next) {
-        return prev + Number(next.width ?? '0');
-      }, 0);
-    });
     const searchContext = inject<TableSearchContext>(props.searchSymbol)!;
     const pageContext = inject<TablePageContext>(props.pageSymbol)!;
 
@@ -62,6 +57,12 @@ export default defineComponent({
       ];
     });
 
+    const tableWidth = computed(function() {
+      return columns.value.reduce(function(prev, next) {
+        return prev + Number(next.width ?? '0');
+      }, 0);
+    });
+
     return () => (
       <NDataTable
         loading={searchContext.isSearching}