mirror of https://github.com/halo-dev/halo-admin
feat: add preview theme support (#660)
#### What type of PR is this? /kind feature /milestone 2.0 #### What this PR does / why we need it: Ref https://github.com/halo-dev/halo/pull/2280 支持在 Console 预览主题。 #### Screenshots: <img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/197442483-e89b8c3c-441e-4668-9840-96fe741a1f95.png"> #### Special notes for your reviewer: 测试方式:进入主题管理,打开已安装主题列表,在每一项的更多按钮即可看到预览主题的按钮。 #### Does this PR introduce a user-facing change? ```release-note 支持在 Console 预览主题。 ```pull/665/head
parent
a095c07ae1
commit
274cb19fcf
@ -0,0 +1,53 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { VModal, IconLink } from "@halo-dev/components";
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
visible: boolean;
|
||||||
|
title?: string;
|
||||||
|
url?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
visible: false,
|
||||||
|
title: undefined,
|
||||||
|
url: "",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: "update:visible", visible: boolean): void;
|
||||||
|
(event: "close"): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const onVisibleChange = (visible: boolean) => {
|
||||||
|
emit("update:visible", visible);
|
||||||
|
if (!visible) {
|
||||||
|
emit("close");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VModal
|
||||||
|
:body-class="['!p-0']"
|
||||||
|
:visible="visible"
|
||||||
|
fullscreen
|
||||||
|
:title="title"
|
||||||
|
@update:visible="onVisibleChange"
|
||||||
|
>
|
||||||
|
<template #actions>
|
||||||
|
<slot name="actions"></slot>
|
||||||
|
<span>
|
||||||
|
<a :href="url" target="_blank">
|
||||||
|
<IconLink />
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<div class="flex h-full items-center justify-center">
|
||||||
|
<iframe
|
||||||
|
v-if="visible"
|
||||||
|
class="h-full w-full border-none transition-all duration-300"
|
||||||
|
:src="url"
|
||||||
|
></iframe>
|
||||||
|
</div>
|
||||||
|
</VModal>
|
||||||
|
</template>
|
Loading…
Reference in new issue