feat: script setup
parent
736c72e688
commit
3eaa81ff19
|
@ -1,5 +1,11 @@
|
||||||
<script lang="ts">
|
<template>
|
||||||
import { defineComponent, computed, unref } from 'vue'
|
<LayoutLockPage />
|
||||||
|
<BackTop v-if="getUseOpenBackTop" :target="getTarget" />
|
||||||
|
<SettingDrawer v-if="getIsFixedSettingDrawer" :class="prefixCls" />
|
||||||
|
<SessionTimeoutLogin v-if="getIsSessionTimeout" />
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup name="LayoutFeatures">
|
||||||
|
import { computed, unref } from 'vue'
|
||||||
import { BackTop } from 'ant-design-vue'
|
import { BackTop } from 'ant-design-vue'
|
||||||
|
|
||||||
import { useRootSetting } from '@/hooks/setting/useRootSetting'
|
import { useRootSetting } from '@/hooks/setting/useRootSetting'
|
||||||
|
@ -10,53 +16,33 @@ import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
import { SettingButtonPositionEnum } from '@/enums/appEnum'
|
import { SettingButtonPositionEnum } from '@/enums/appEnum'
|
||||||
import { createAsyncComponent } from '@/utils/factory/createAsyncComponent'
|
import { createAsyncComponent } from '@/utils/factory/createAsyncComponent'
|
||||||
|
|
||||||
import SessionTimeoutLogin from '@/views/base/login/SessionTimeoutLogin.vue'
|
import SessionTimeoutLogin from '@/views/sys/login/SessionTimeoutLogin.vue'
|
||||||
export default defineComponent({
|
|
||||||
name: 'LayoutFeatures',
|
|
||||||
components: {
|
|
||||||
BackTop,
|
|
||||||
LayoutLockPage: createAsyncComponent(() => import('@/views/base/lock/index.vue')),
|
|
||||||
SettingDrawer: createAsyncComponent(() => import('@/layouts/default/setting/index.vue')),
|
|
||||||
SessionTimeoutLogin
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const { getUseOpenBackTop, getShowSettingButton, getSettingButtonPosition, getFullContent } = useRootSetting()
|
|
||||||
const userStore = useUserStoreWithOut()
|
|
||||||
const { prefixCls } = useDesign('setting-drawer-feature')
|
|
||||||
const { getShowHeader } = useHeaderSetting()
|
|
||||||
|
|
||||||
const getIsSessionTimeout = computed(() => userStore.getSessionTimeout)
|
const LayoutLockPage = createAsyncComponent(() => import('@/views/sys/lock/index.vue'))
|
||||||
|
|
||||||
const getIsFixedSettingDrawer = computed(() => {
|
const SettingDrawer = createAsyncComponent(() => import('@/layouts/default/setting/index.vue'))
|
||||||
if (!unref(getShowSettingButton)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
const settingButtonPosition = unref(getSettingButtonPosition)
|
|
||||||
|
|
||||||
if (settingButtonPosition === SettingButtonPositionEnum.AUTO) {
|
const { getUseOpenBackTop, getShowSettingButton, getSettingButtonPosition, getFullContent } = useRootSetting()
|
||||||
return !unref(getShowHeader) || unref(getFullContent)
|
const userStore = useUserStoreWithOut()
|
||||||
}
|
const { prefixCls } = useDesign('setting-drawer-feature')
|
||||||
return settingButtonPosition === SettingButtonPositionEnum.FIXED
|
const { getShowHeader } = useHeaderSetting()
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
const getTarget = () => document.body
|
||||||
getTarget: () => document.body,
|
|
||||||
getUseOpenBackTop,
|
const getIsSessionTimeout = computed(() => userStore.getSessionTimeout)
|
||||||
getIsFixedSettingDrawer,
|
|
||||||
prefixCls,
|
const getIsFixedSettingDrawer = computed(() => {
|
||||||
getIsSessionTimeout
|
if (!unref(getShowSettingButton)) {
|
||||||
}
|
return false
|
||||||
}
|
}
|
||||||
|
const settingButtonPosition = unref(getSettingButtonPosition)
|
||||||
|
|
||||||
|
if (settingButtonPosition === SettingButtonPositionEnum.AUTO) {
|
||||||
|
return !unref(getShowHeader) || unref(getFullContent)
|
||||||
|
}
|
||||||
|
return settingButtonPosition === SettingButtonPositionEnum.FIXED
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
|
||||||
<LayoutLockPage />
|
|
||||||
<BackTop v-if="getUseOpenBackTop" :target="getTarget" />
|
|
||||||
<SettingDrawer v-if="getIsFixedSettingDrawer" :class="prefixCls" />
|
|
||||||
<SessionTimeoutLogin v-if="getIsSessionTimeout" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@prefix-cls: ~'@{namespace}-setting-drawer-feature';
|
@prefix-cls: ~'@{namespace}-setting-drawer-feature';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue