feat: add full screen in area feature (#30)
This commit is contained in:
parent
907dc21d55
commit
9557c5679e
@ -3,17 +3,25 @@ import { ref, onUnmounted } from "vue"
|
|||||||
import { ElMessage } from "element-plus"
|
import { ElMessage } from "element-plus"
|
||||||
import screenfull from "screenfull"
|
import screenfull from "screenfull"
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
areaScreenFull: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
type contentType = "全屏" | "退出全屏"
|
type contentType = "全屏" | "退出全屏"
|
||||||
|
|
||||||
const content = ref<contentType>("全屏")
|
const content = ref<contentType>("全屏")
|
||||||
const isFullscreen = ref(false)
|
const isFullscreen = ref(false)
|
||||||
|
|
||||||
const click = () => {
|
const click = () => {
|
||||||
|
const element = document.querySelector(".app-container") || undefined
|
||||||
if (!screenfull.isEnabled) {
|
if (!screenfull.isEnabled) {
|
||||||
ElMessage.warning("您的浏览器无法工作")
|
ElMessage.warning("您的浏览器无法工作")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
screenfull.toggle()
|
screenfull.toggle(props.areaScreenFull ? element : undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
const change = () => {
|
const change = () => {
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue"
|
import { computed, ref } from "vue"
|
||||||
import { ElScrollbar } from "element-plus"
|
import { ElScrollbar } from "element-plus"
|
||||||
import { ArrowLeft, ArrowRight } from "@element-plus/icons-vue"
|
import { ArrowLeft, ArrowRight } from "@element-plus/icons-vue"
|
||||||
|
import { useSettingsStore } from "@/store/modules/settings"
|
||||||
|
import Screenfull from "@/components/Screenfull/index.vue"
|
||||||
|
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
|
||||||
const scrollbarRef = ref<InstanceType<typeof ElScrollbar>>()
|
const scrollbarRef = ref<InstanceType<typeof ElScrollbar>>()
|
||||||
const scrollbarContentRef = ref<HTMLDivElement>()
|
const scrollbarContentRef = ref<HTMLDivElement>()
|
||||||
@ -34,6 +38,9 @@ const scrollTo = (direction: "left" | "right") => {
|
|||||||
}
|
}
|
||||||
scrollbarRef.value!.setScrollLeft(scrollLeft)
|
scrollbarRef.value!.setScrollLeft(scrollLeft)
|
||||||
}
|
}
|
||||||
|
const showScreenfull = computed(() => {
|
||||||
|
return settingsStore.showScreenfull
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -49,6 +56,7 @@ const scrollTo = (direction: "left" | "right") => {
|
|||||||
<el-icon class="arrow right" @click="scrollTo('right')">
|
<el-icon class="arrow right" @click="scrollTo('right')">
|
||||||
<ArrowRight />
|
<ArrowRight />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
<Screenfull :areaScreenFull="true" v-if="showScreenfull" class="right-menu-item" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -77,5 +85,23 @@ const scrollTo = (direction: "left" | "right") => {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right-menu-item {
|
||||||
|
padding: 0 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
.right-menu-avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.el-avatar {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user