vue3【实战】切换全屏【组件封装】FullScreen.vue-代码实现

技术方案

vue3 + vite + UnoCSS + vueUse

组件封装

src/components/FullScreen.vue

<template>
  <component
    :is="tag"
    @click="toggle"
    :class="[
      !isFullscreen ? 'i-ep:full-screen' : 'i-ri:fullscreen-exit-fill',
      'cursor-pointer',
      iconClass
    ]"
  ></component>
</template>

<script setup lang="ts">
const { isFullscreen, toggle } = useFullscreen()

defineProps({
  tag: {
    type: String,
    default: 'i'
  },
  iconClass: {
    type: String,
    default: 'text-xl'
  }
})
</script>

页面使用

<FullScreen />
上一篇:LLM大模型微调入门Lora(LlamaFactory)


下一篇:Javaweb-day12(登录认证)