diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index b32694c9c..d43cbfb8a 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -4109,6 +4109,519 @@ exports[`renders ./components/table/demo/size.vue correctly 1`] = ` `; +exports[`renders ./components/table/demo/sticky.vue correctly 1`] = ` +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
+ Full Name + + Age + + Column 1 + + Column 2 + + Column 3 + + Column 4 + + Column 5 + + Column 6 + + Column 7 + + Column 8 + + Action +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Edrward 0 + + 32 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + London Park no. 0 + + action +
+ Edrward 1 + + 32 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + London Park no. 1 + + action +
+ Edrward 2 + + 32 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + London Park no. 2 + + action +
+ Edrward 3 + + 32 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + London Park no. 3 + + action +
+ Edrward 4 + + 32 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + London Park no. 4 + + action +
+ Edrward 5 + + 32 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + London Park no. 5 + + action +
+ Edrward 6 + + 32 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + London Park no. 6 + + action +
+ Edrward 7 + + 32 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + London Park no. 7 + + action +
+ Edrward 8 + + 32 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + London Park no. 8 + + action +
+ Edrward 9 + + 32 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + London Park no. 9 + + action +
+ Fix Left + + Scroll Context + + Fix Right +
+
+ + +
+ +
+ +
+
+
+`; + exports[`renders ./components/table/demo/stripe.vue correctly 1`] = `
diff --git a/components/table/demo/index.vue b/components/table/demo/index.vue index 8564b0034..e4aa9ba15 100644 --- a/components/table/demo/index.vue +++ b/components/table/demo/index.vue @@ -21,6 +21,7 @@ + @@ -55,6 +56,7 @@ import Ellipsis from './ellipsis.vue'; import Stripe from './stripe.vue'; import MultipleSorter from './multiple-sorter.vue'; import Summary from './summary.vue'; +import Sticky from './sticky.vue'; import CN from '../index.zh-CN.md'; import US from '../index.en-US.md'; import { defineComponent } from '@vue/runtime-core'; @@ -88,6 +90,7 @@ export default defineComponent({ Stripe, MultipleSorter, Summary, + Sticky, }, }); diff --git a/components/vc-table/Table.tsx b/components/vc-table/Table.tsx index 9adb8d056..32bcbc4be 100644 --- a/components/vc-table/Table.tsx +++ b/components/vc-table/Table.tsx @@ -728,7 +728,7 @@ export default defineComponent>({ > )} - {isSticky && ( + {isSticky && scrollBodyRef.value && (