wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
  <div
    v-if="showButton && (!dvMainStore.mobileInPc || isMobile())"
    class="bar-main-right"
    @mousedown="handOptBarMousedown"
  >
    <el-button size="mini" type="info" @click="exitFullscreen">
      <el-icon style="margin-right: 8px">
        <Icon name="exit_fullscreen"
          ><exit_fullscreen style="font-size: 16px" class="svg-icon"
        /></Icon>
      </el-icon>
      {{ $t('visualization.ext_fullscreen') }}</el-button
    >
  </div>
</template>
 
<script lang="ts" setup>
import exit_fullscreen from '@/assets/svg/exit-fullscreen.svg'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { computed } from 'vue'
import { isMainCanvas } from '@/utils/canvasUtils'
import { isMobile } from '@/utils/utils'
import { storeToRefs } from 'pinia'
import Icon from '../icon-custom/src/Icon.vue'
import { ElIcon } from 'element-plus-secondary'
const dvMainStore = dvMainStoreWithOut()
 
const { fullscreenFlag } = storeToRefs(dvMainStore)
 
const props = defineProps({
  canvasId: {
    type: String,
    required: false,
    default: 'canvas-main'
  },
  showPosition: {
    required: false,
    type: String,
    default: 'preview'
  }
})
 
const handOptBarMousedown = e => {
  e.preventDefault()
  e.stopPropagation()
}
 
const showButton = computed(() => {
  if (isMainCanvas(props.canvasId)) {
    return fullscreenFlag.value && props.showPosition === 'preview'
  } else {
    return false
  }
})
 
const exitFullscreen = () => {
  document.exitFullscreen()
}
</script>
 
<style lang="less" scoped>
.bar-main-right {
  top: 2px;
  right: 2px;
  opacity: 0.8;
  z-index: 1;
  position: absolute;
}
 
.bar-main-edit-right {
  top: 8px;
  right: 102px !important;
}
 
.bar-main-left {
  left: 0px;
  opacity: 0;
  height: fit-content;
  &:hover {
    opacity: 0.8;
  }
}
</style>