页面截图

This commit is contained in:
仲么了
2024-01-12 14:05:36 +08:00
parent 8d18e53d51
commit df192a9a7f
6 changed files with 130 additions and 34 deletions

View File

@@ -1,5 +1,13 @@
<template>
<div class="nav-menus" :class="configStore.layout.layoutMode">
<div @click="savePng" class="nav-menu-item">
<Icon
:color="configStore.getColorVal('headerBarTabColor')"
class="nav-menu-icon"
name="el-icon-Camera"
size="18"
/>
</div>
<div @click="onFullScreen" class="nav-menu-item" :class="state.isFullScreen ? 'hover' : ''">
<Icon
:color="configStore.getColorVal('headerBarTabColor')"
@@ -75,6 +83,7 @@ import { ADMIN_INFO } from '@/stores/constant/cacheKey'
import router from '@/router'
import { routePush } from '@/utils/router'
import { fullUrl } from '@/utils/common'
import html2canvas from 'html2canvas'
const adminInfo = useAdminInfo()
const configStore = useConfig()
@@ -89,7 +98,18 @@ const state = reactive({
const onCurrentNavMenu = (status: boolean, name: string) => {
state.currentNavMenu = status ? name : ''
}
const savePng = () => {
html2canvas(document.body,{
scale: 1,
useCORS: true
}).then(function (canvas) {
var link = document.createElement('a')
link.href = canvas.toDataURL('image/png')
link.download = 'screenshot.png'
link.click()
})
}
const onFullScreen = () => {
if (!screenfull.isEnabled) {
ElMessage.warning('layouts.Full screen is not supported')

View File

@@ -98,7 +98,7 @@ const init = async () => {
icon: 'el-icon-List',
menu_type: 'tab',
url: '',
component: '/src/views/govern/analyze/APF/index.vue',
component: '/src/views/govern/analyze/DVR/index.vue',
keepalive: 'auth/role',
extend: 'none',
children: []