feat(short-drama-agent-front): 新增剧本骨架屏并优化阅读导出

This commit is contained in:
GJ committed 2026-10-10 23:12:59 +08:00
1 parent 54a381ebd3
commit 3cc65aa056
16 files changed
+792 -167

No files matched your search

-16
View File
@@ -140,22 +140,6 @@ onBeforeUnmount(() => {
@apply min-h-0;
}
.app-dialog .n-card-header__close {
@apply grid place-items-center w-10 h-10 -m-2 rounded-none bg-transparent;
}
.app-dialog .n-card-header__close .n-base-icon {
@apply p-2 box-content bg-(--app-subtle);
}
.app-dialog .n-card-header__close:hover {
@apply bg-transparent;
}
.app-dialog .n-card-header__close:hover .n-base-icon {
@apply bg-(--app-control-hover);
}
.app-dialog .n-card__footer {
@apply shrink-0 bg-(--app-surface);
display: flex;
@@ -0,0 +1,76 @@
<script setup lang="ts">
import { Download } from '@lucide/vue'
import { NButton, NPopover } from 'naive-ui'
import { ref, watch } from 'vue'
/** 工作区标签栏的直接导出入口。 */
interface Props {
/** 悬浮说明与无障碍按钮名称。 */
label: string
/** 当前没有可导出的数据时禁用。 */
disabled?: boolean
}
/** 导出按钮使用页面提供的说明与禁用状态。 */
defineProps<Props>()
/** 点击按钮时通知页面导出当前已读取的数据。 */
const emit = defineEmits<{ export: [] }>()
/** 导出容器跟随父标签栏的实际高度。 */
const container = ref<HTMLElement | null>(null)
/** 按钮边长首次测量前沿用标签栏默认高度。 */
const buttonSize = ref(40)
/** 标签栏尺寸变化时保持按钮为正方形,卸载后释放监听。 */
watch(
container,
(element, _previous, onCleanup) => {
if (!element) return
buttonSize.value = element.getBoundingClientRect().height || 40
if (typeof ResizeObserver === 'undefined') return
const observer = new ResizeObserver(() => {
const height = element.getBoundingClientRect().height
if (height > 0) buttonSize.value = height
})
observer.observe(element)
onCleanup(() => observer.disconnect())
},
{ flush: 'post' }
)
</script>
<template>
<!-- 以下是随标签栏高度保持正方形的导出图标与悬浮说明模块 -->
<div
ref="container"
class="tabs-toolbar-actions workspace-export-action"
:style="{ '--export-button-size': `${buttonSize}px` }"
>
<NPopover trigger="hover" placement="bottom-end">
<template #trigger>
<NButton
quaternary
size="small"
class="icon-button workspace-export-button"
:aria-label="label"
:disabled="disabled"
@click="emit('export')"
>
<template #icon><Download :size="18" aria-hidden="true" /></template>
</NButton>
</template>
{{ label }}
</NPopover>
</div>
</template>
<style scoped>
@reference "../../styles/styles.css";
.workspace-export-action {
/* 与父标签栏一起拉伸,说明文字由 Popover 展示,不占按钮宽度。 */
@apply items-stretch self-stretch shrink-0 flex-nowrap;
}
.workspace-export-action .n-button.workspace-export-button {
width: var(--export-button-size);
min-width: 0;
height: 100%;
align-self: stretch;
}
</style>