Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ExtractPropTypes, HTMLAttributes } from 'vue';
import { computed, createVNode, defineComponent, provide, ref } from 'vue';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import { SiderHookProviderKey } from './injectionKey';
import useStyle from './style';

export const basicProps = () => ({
prefixCls: String,
Expand All @@ -18,7 +19,7 @@ type GeneratorArgument = {
};

function generator({ suffixCls, tagName, name }: GeneratorArgument) {
return (BasicComponent: typeof Basic) => {
return (BasicComponent: typeof BasicLayout) => {
const Adapter = defineComponent({
compatConfig: { MODE: 3 },
name,
Expand Down Expand Up @@ -49,9 +50,11 @@ const Basic = defineComponent({

const BasicLayout = defineComponent({
compatConfig: { MODE: 3 },
inheritAttrs: false,
props: basicProps(),
setup(props, { slots }) {
const { direction } = useConfigInject('', props);
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('', props);
const [wrapSSR, hashId] = useStyle(prefixCls);
const siders = ref<string[]>([]);
const siderHookProvider = {
addSider: (id: string) => {
Expand All @@ -66,6 +69,7 @@ const BasicLayout = defineComponent({
const divCls = computed(() => {
const { prefixCls, hasSider } = props;
return {
[hashId.value]: true,
[`${prefixCls}`]: true,
[`${prefixCls}-has-sider`]:
typeof hasSider === 'boolean' ? hasSider : siders.value.length > 0,
Expand All @@ -74,7 +78,7 @@ const BasicLayout = defineComponent({
});
return () => {
const { tagName } = props;
return createVNode(tagName, { class: divCls.value }, slots);
return wrapSSR(createVNode(tagName, { ...attrs, class: [divCls.value, attrs.class] }, slots));
};
},
});
Expand Down
145 changes: 0 additions & 145 deletions components/layout/style/index.less

This file was deleted.

Loading