This commit is contained in:
2022-11-14 11:56:21 +08:00
commit 0a63adba99
337 changed files with 25661 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
@import "../header/index.less";
.layui-layout {
flex: 1;
display: flex;
flex-basis: auto;
box-sizing: border-box;
}
.layui-layout-vertical {
flex-direction: column;
}
.layui-layout-left {
position: absolute !important;
left: 200px;
top: 0;
}
.layui-layout-right {
position: absolute !important;
right: 0;
top: 0;
}

View File

@@ -0,0 +1,5 @@
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -0,0 +1,45 @@
<script lang="ts">
export default {
name: "LayLayout",
};
</script>
<script setup lang="ts">
import { Component, computed, useSlots } from "vue";
import Header from "../header/index.vue";
import Footer from "../footer/index.vue";
import "./index.less";
export interface LayoutProps {
isVertical?: boolean;
}
const slots = useSlots();
const props = withDefaults(defineProps<LayoutProps>(), {
isVertical: false,
});
const isVertical = computed(() => {
if (!slots.default) return false;
const vNodes = slots.default();
return vNodes.some((vNode) => {
const componentName = (vNode.type as Component).name;
if (!componentName) return false;
return (
[Header.name].includes(componentName) ||
[Footer.name].includes(componentName)
);
});
});
const classes = computed(() => {
return ["layui-layout", { "layui-layout-vertical": isVertical.value }];
});
</script>
<template>
<section :class="classes">
<slot></slot>
</section>
</template>