import { computed, defineComponent } from 'vue'; import { ViewModel } from '@ibiz-template/model'; import { useNamespace } from '@ibiz-template/vue-util'; import '@ibiz-template/theme/style/components/layout/view-layout/view-layout.scss'; export const ViewLayout = defineComponent({ name: 'ViewLayout', props: { modelData: { type: ViewModel, required: true, }, viewMode: { type: String, // ViewMode 类型 default: 'ROUTE', }, // 视图是否完成加载 isComplete: { type: Boolean, default: false, }, isLoading: { type: Boolean, default: false, }, }, setup(props) { const ns = useNamespace('view-layout'); // 是否显示头部 const isShowHeader = computed(() => { return props.modelData.source.showCaptionBar || !!props.modelData.toolbar; }); return { ns, isShowHeader }; }, render() { return !this.isComplete ? (
{this.isLoading ? : null}
) : (
{this.isLoading ? : null} {this.isShowHeader ? (
{this.modelData.source.showCaptionBar ? (
{this.$scopedSlots.caption && this.$scopedSlots.caption({})}
) : null}
{this.$scopedSlots.quickSearch && this.$scopedSlots.quickSearch({})}
{this.$scopedSlots.toolbar && this.$scopedSlots.toolbar({})}
) : null} {this.$scopedSlots.searchForm && this.$scopedSlots.searchForm({}) && (
{this.$scopedSlots.searchForm && this.$scopedSlots.searchForm({})}
)}
{this.$scopedSlots.default && this.$scopedSlots.default({})}
{this.$scopedSlots.footer && (
{this.$scopedSlots.footer && this.$scopedSlots.footer({})}
)}
); }, });