Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@vben/playground): add full-screen examples #4126

Merged
merged 8 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions playground/src/locales/langs/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"watermark": "Watermark",
"tabs": "Tabs",
"tabDetail": "Tab Detail Page",
"fullScreen": {
"title": "FullScreen"
},
"clipboard": "Clipboard"
},
"breadcrumb": {
Expand Down
3 changes: 3 additions & 0 deletions playground/src/locales/langs/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"watermark": "水印",
"tabs": "标签页",
"tabDetail": "标签详情页",
"fullScreen": {
"title": "全屏"
},
"clipboard": "剪贴板"
},
"breadcrumb": {
Expand Down
9 changes: 9 additions & 0 deletions playground/src/router/routes/modules/demos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
name: 'FullScreenDemo',
path: '/demos/features/full-screen',
component: () =>
import('#/views/demos/features/full-screen/index.vue'),
meta: {
title: $t('page.demos.features.fullScreen.title'),
},
},
{
name: 'ClipboardDemo',
path: '/demos/features/clipboard',
Expand Down
2 changes: 1 addition & 1 deletion playground/src/router/routes/modules/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const routes: RouteRecordRaw[] = [
children: [
{
name: 'EllipsisDemo',
path: '/examples/ellipsis',
path: 'ellipsis',
component: () => import('#/views/examples/ellipsis/index.vue'),
meta: {
title: $t('page.examples.ellipsis.title'),
Expand Down
47 changes: 47 additions & 0 deletions playground/src/views/demos/features/full-screen/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script lang="ts" setup>
import { ref } from 'vue';

import { Page } from '@vben/common-ui';

import { useFullscreen } from '@vueuse/core';
import { Button, Card } from 'ant-design-vue';

const domRef = ref<HTMLElement>();

const { enter, exit, isFullscreen, toggle } = useFullscreen();

const { isFullscreen: isDomFullscreen, toggle: toggleDom } =
useFullscreen(domRef);
</script>

<template>
<Page title="全屏示例">
<Card title="Window Full Screen">
<div class="flex flex-wrap items-center gap-4">
<Button :disabled="isFullscreen" type="primary" @click="enter">
Enter Window Full Screen
</Button>
<Button @click="toggle"> Toggle Window Full Screen </Button>

<Button :disabled="!isFullscreen" danger @click="exit">
Exit Window Full Screen
</Button>

<span class="text-nowrap"> Current State: {{ isFullscreen }} </span>
</div>
</Card>

<Card class="mt-3" title="Dom Full Screen">
<Button type="primary" @click="toggleDom"> Enter Dom Full Screen </Button>
</Card>

<div
ref="domRef"
class="mx-auto mt-10 flex h-64 w-1/2 items-center justify-center rounded-md bg-yellow-400"
>
<Button class="mr-2" type="primary" @click="toggleDom">
{{ isDomFullscreen ? 'Exit Dom Full Screen' : 'Enter Dom Full Screen' }}
</Button>
</div>
</Page>
</template>
Loading