diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 5f3a92a..4463f92 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -4,29 +4,38 @@ import { ElMessage } from "element-plus" import screenfull from "screenfull" const props = defineProps({ - areaScreenFull: { - type: Boolean, - required: false + /** 全屏的元素,默认是 html */ + element: { + type: String, + default: "html" + }, + /** 打开全屏提示语 */ + openTips: { + type: String, + default: "全屏" + }, + /** 关闭全屏提示语 */ + exitTips: { + type: String, + default: "退出全屏" } }) -type contentType = "全屏" | "退出全屏" - -const content = ref("全屏") -const isFullscreen = ref(false) +const tips = ref(props.openTips) +const isFullscreen = ref(false) const click = () => { - const element = document.querySelector(".app-container") || undefined + const dom = document.querySelector(props.element) || undefined if (!screenfull.isEnabled) { ElMessage.warning("您的浏览器无法工作") return } - screenfull.toggle(props.areaScreenFull ? element : undefined) + screenfull.toggle(dom) } const change = () => { isFullscreen.value = screenfull.isFullscreen - content.value = screenfull.isFullscreen ? "退出全屏" : "全屏" + tips.value = screenfull.isFullscreen ? props.exitTips : props.openTips } screenfull.on("change", change) @@ -40,7 +49,7 @@ onUnmounted(() => { @@ -85,23 +85,12 @@ const showScreenfull = computed(() => { display: inline-block; } } - - .right-menu-item { - padding: 0 10px; + .screenfull { + width: 40px; 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; - } - } } } diff --git a/src/styles/theme/core/layout.scss b/src/styles/theme/core/layout.scss index 133944d..1553550 100644 --- a/src/styles/theme/core/layout.scss +++ b/src/styles/theme/core/layout.scss @@ -1,7 +1,6 @@ /** Layout 相关 */ .app-wrapper { - background-color: $theme-bg-color; color: $font-color; // 侧边栏 diff --git a/src/styles/theme/core/other.scss b/src/styles/theme/core/other.scss index cbb15b3..d32d6fe 100644 --- a/src/styles/theme/core/other.scss +++ b/src/styles/theme/core/other.scss @@ -1,6 +1,7 @@ /** 这里可以写业务页面的黑暗样式 */ .app-main { + background-color: $theme-bg-color !important; // 指令权限页面 @/views/permission/directive.vue .permission-alert { background-color: lighten($theme-bg-color, 8%);