You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
846 B
TypeScript
30 lines
846 B
TypeScript
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue'
|
|
import { Tooltip } from 'ant-design-vue'
|
|
import { useIntl } from '#/provider'
|
|
import { useToggle } from '@vueuse/core'
|
|
import { watchEffect } from 'vue'
|
|
|
|
const FullScreenIcon = () => {
|
|
const intl = useIntl()
|
|
const [fullscreen, setFullscreen] = useToggle(false)
|
|
watchEffect(() => {
|
|
// if (!isBrowser()) {
|
|
// return
|
|
// }
|
|
document.onfullscreenchange = () => {
|
|
setFullscreen(!!document.fullscreenElement)
|
|
}
|
|
})
|
|
return fullscreen.value ? (
|
|
<Tooltip title={intl.getMessage('tableToolBar.exitFullScreen', '全屏')}>
|
|
<FullscreenExitOutlined />
|
|
</Tooltip>
|
|
) : (
|
|
<Tooltip title={intl.getMessage('tableToolBar.fullScreen', '全屏')}>
|
|
<FullscreenOutlined />
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export default FullScreenIcon
|