Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
src/layouts/default/content/index.vue
@@ -1,41 +1,45 @@
<template>
  <div :class="[prefixCls, getLayoutContentMode]" v-loading="getOpenPageLoading && getPageLoading">
  <div
    :class="[prefixCls, getLayoutContentMode]"
    v-loading="getOpenPageLoading && getPageLoading"
    ref="content"
  >
    <PageLayout />
    <BackTop v-if="getUseOpenBackTop" :target="() => content" :visibilityHeight="100" />
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  import PageLayout from '/@/layouts/page/index.vue';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
<script lang="ts" setup>
  import { ref } from 'vue';
  import { BackTop } from 'ant-design-vue';
  import PageLayout from '@/layouts/page/index.vue';
  import { useDesign } from '@/hooks/web/useDesign';
  import { useRootSetting } from '@/hooks/setting/useRootSetting';
  import { useTransitionSetting } from '@/hooks/setting/useTransitionSetting';
  import { useContentViewHeight } from './useContentViewHeight';
  export default defineComponent({
    name: 'LayoutContent',
    components: { PageLayout },
    setup() {
  defineOptions({ name: 'LayoutContent' });
      const { prefixCls } = useDesign('layout-content');
      const { getOpenPageLoading } = useTransitionSetting();
      const { getLayoutContentMode, getPageLoading } = useRootSetting();
  const { getLayoutContentMode, getPageLoading, getUseOpenBackTop } = useRootSetting();
      useContentViewHeight();
      return {
        prefixCls,
        getOpenPageLoading,
        getLayoutContentMode,
        getPageLoading,
      };
    },
  });
  const content = ref();
</script>
<style lang="less">
  @prefix-cls: ~'@{namespace}-layout-content';
  .@{prefix-cls} {
    display: flex;
    position: relative;
    flex: 1 1 auto;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    height: 0;
    min-height: 0;
    overflow: auto;
    // begin: 下面这块代码 在我的项目打包后在比较宽的屏幕(2K 31 寸)有显示 bug 有偶发性 清缓存首次进入会出现 , 刷新就没了, 这里为什么要指定宽度 ?
    &.fixed {