layui-vue/es/layout/index.js
2022-11-14 11:59:26 +08:00

41 lines
1.6 KiB
JavaScript

import { w as withInstall } from "../badge/index2.js";
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from "vue";
import { _ as _sfc_main$1 } from "../header/index2.js";
import { _ as _sfc_main$2 } from "../footer/index2.js";
var index = /* @__PURE__ */ (() => ".layui-header{box-sizing:border-box;height:60px}.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}\n")();
const __default__ = {
name: "LayLayout"
};
const _sfc_main = defineComponent({
...__default__,
props: {
isVertical: { type: Boolean, default: false }
},
setup(__props) {
const slots = useSlots();
const isVertical = computed(() => {
if (!slots.default)
return false;
const vNodes = slots.default();
return vNodes.some((vNode) => {
const componentName = vNode.type.name;
if (!componentName)
return false;
return [_sfc_main$1.name].includes(componentName) || [_sfc_main$2.name].includes(componentName);
});
});
const classes = computed(() => {
return ["layui-layout", { "layui-layout-vertical": isVertical.value }];
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("section", {
class: normalizeClass(unref(classes))
}, [
renderSlot(_ctx.$slots, "default")
], 2);
};
}
});
const component = withInstall(_sfc_main);
export { component as default };