feat: script setup

pull/4/MERGE
xingyuv 2023-03-29 14:17:35 +08:00
parent 736c72e688
commit 3eaa81ff19
1 changed files with 28 additions and 42 deletions

View File

@ -1,5 +1,11 @@
<script lang="ts">
import { defineComponent, computed, unref } from 'vue'
<template>
<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 { useRootSetting } from '@/hooks/setting/useRootSetting'
@ -10,21 +16,19 @@ import { useUserStoreWithOut } from '@/store/modules/user'
import { SettingButtonPositionEnum } from '@/enums/appEnum'
import { createAsyncComponent } from '@/utils/factory/createAsyncComponent'
import SessionTimeoutLogin from '@/views/base/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() {
import SessionTimeoutLogin from '@/views/sys/login/SessionTimeoutLogin.vue'
const LayoutLockPage = createAsyncComponent(() => import('@/views/sys/lock/index.vue'))
const SettingDrawer = createAsyncComponent(() => import('@/layouts/default/setting/index.vue'))
const { getUseOpenBackTop, getShowSettingButton, getSettingButtonPosition, getFullContent } = useRootSetting()
const userStore = useUserStoreWithOut()
const { prefixCls } = useDesign('setting-drawer-feature')
const { getShowHeader } = useHeaderSetting()
const getTarget = () => document.body
const getIsSessionTimeout = computed(() => userStore.getSessionTimeout)
const getIsFixedSettingDrawer = computed(() => {
@ -38,25 +42,7 @@ export default defineComponent({
}
return settingButtonPosition === SettingButtonPositionEnum.FIXED
})
return {
getTarget: () => document.body,
getUseOpenBackTop,
getIsFixedSettingDrawer,
prefixCls,
getIsSessionTimeout
}
}
})
</script>
<template>
<LayoutLockPage />
<BackTop v-if="getUseOpenBackTop" :target="getTarget" />
<SettingDrawer v-if="getIsFixedSettingDrawer" :class="prefixCls" />
<SessionTimeoutLogin v-if="getIsSessionTimeout" />
</template>
<style lang="less">
@prefix-cls: ~'@{namespace}-setting-drawer-feature';