fix task article link drawer
This commit is contained in:
@@ -0,0 +1,236 @@
|
||||
<script setup lang="ts">
|
||||
import { FileTextOutlined, RightOutlined } from '@ant-design/icons-vue'
|
||||
import type { GeneratedArticleLink } from '@geo/shared-types'
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { formatDateTime, getGenerateStatusMeta } from '@/lib/display'
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean
|
||||
articles: GeneratedArticleLink[]
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean]
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const drawerOpen = computed({
|
||||
get: () => props.open,
|
||||
set: (value: boolean) => emit('update:open', value),
|
||||
})
|
||||
|
||||
function canOpenArticle(article: GeneratedArticleLink): boolean {
|
||||
return article.generate_status === 'completed'
|
||||
}
|
||||
|
||||
function articleTitle(article: GeneratedArticleLink, index: number): string {
|
||||
return article.title || `${t('article.untitled')} ${index + 1}`
|
||||
}
|
||||
|
||||
function openArticle(article: GeneratedArticleLink): void {
|
||||
if (!canOpenArticle(article)) {
|
||||
return
|
||||
}
|
||||
emit('update:open', false)
|
||||
const returnTo = router.resolve({
|
||||
name: route.name ?? undefined,
|
||||
params: route.params,
|
||||
query: route.query,
|
||||
})
|
||||
void router.push({
|
||||
name: 'article-editor',
|
||||
params: { id: String(article.article_id) },
|
||||
query: { return_to: returnTo.fullPath },
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-drawer
|
||||
v-model:open="drawerOpen"
|
||||
:title="t('custom.instant.generatedArticles')"
|
||||
width="560px"
|
||||
placement="right"
|
||||
:body-style="{ padding: '16px 24px', background: '#f7f8fa' }"
|
||||
>
|
||||
<div class="generated-article-links">
|
||||
<template v-if="articles.length > 0">
|
||||
<div
|
||||
v-for="(item, index) in articles"
|
||||
:key="item.article_id || index"
|
||||
class="generated-article-links__item"
|
||||
:class="{ 'generated-article-links__item--clickable': canOpenArticle(item) }"
|
||||
@click="openArticle(item)"
|
||||
>
|
||||
<div
|
||||
class="generated-article-links__icon"
|
||||
:class="`generated-article-links__icon--${item.generate_status}`"
|
||||
>
|
||||
<FileTextOutlined />
|
||||
</div>
|
||||
<div class="generated-article-links__content">
|
||||
<div class="generated-article-links__header">
|
||||
<a-tooltip :title="articleTitle(item, index)">
|
||||
<div class="generated-article-links__title">
|
||||
{{ articleTitle(item, index) }}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
<a-tag
|
||||
class="generated-article-links__status"
|
||||
:color="getGenerateStatusMeta(item.generate_status).color"
|
||||
:bordered="false"
|
||||
>
|
||||
{{ getGenerateStatusMeta(item.generate_status).label }}
|
||||
</a-tag>
|
||||
</div>
|
||||
<div class="generated-article-links__meta">
|
||||
{{ formatDateTime(item.created_at) }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="canOpenArticle(item)" class="generated-article-links__action">
|
||||
<a-button type="link" size="small" @click.stop="openArticle(item)">
|
||||
{{ t('custom.instant.openArticle') }}
|
||||
<RightOutlined />
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<a-empty
|
||||
v-else
|
||||
:description="t('custom.instant.articleLinksEmpty')"
|
||||
class="generated-article-links__empty"
|
||||
/>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.generated-article-links {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.generated-article-links__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
min-height: 74px;
|
||||
padding: 16px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e5e6eb;
|
||||
border-radius: 8px;
|
||||
transition:
|
||||
border-color 0.2s,
|
||||
box-shadow 0.2s,
|
||||
transform 0.2s;
|
||||
}
|
||||
|
||||
.generated-article-links__item--clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.generated-article-links__item--clickable:hover {
|
||||
border-color: #1677ff;
|
||||
box-shadow: 0 4px 12px rgba(22, 119, 255, 0.08);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.generated-article-links__icon {
|
||||
display: flex;
|
||||
flex: 0 0 40px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
color: #1677ff;
|
||||
font-size: 20px;
|
||||
background-color: #f0f5ff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.generated-article-links__icon--failed {
|
||||
color: #ff4d4f;
|
||||
background-color: #fff1f0;
|
||||
}
|
||||
|
||||
.generated-article-links__icon--completed {
|
||||
color: #52c41a;
|
||||
background-color: #f6ffed;
|
||||
}
|
||||
|
||||
.generated-article-links__icon--running,
|
||||
.generated-article-links__icon--generating,
|
||||
.generated-article-links__icon--queued {
|
||||
color: #1677ff;
|
||||
background-color: #e6f4ff;
|
||||
}
|
||||
|
||||
.generated-article-links__content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.generated-article-links__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.generated-article-links__title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #1d2129;
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.generated-article-links__item--clickable .generated-article-links__title {
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.generated-article-links__item--clickable:hover .generated-article-links__title {
|
||||
color: #1677ff;
|
||||
}
|
||||
|
||||
.generated-article-links__status {
|
||||
margin-inline-end: 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.generated-article-links__meta {
|
||||
color: #86909c;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.generated-article-links__action {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.generated-article-links__action :deep(.ant-btn) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.generated-article-links__empty {
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@ import type { Dayjs } from 'dayjs'
|
||||
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import ArticleDetailDrawer from '@/components/ArticleDetailDrawer.vue'
|
||||
import GeneratedArticleLinksDrawer from '@/components/GeneratedArticleLinksDrawer.vue'
|
||||
import { instantTasksApi, promptRulesApi } from '@/lib/api'
|
||||
import { formatDateTime, getGenerateStatusMeta } from '@/lib/display'
|
||||
import { formatPublishPlatformList } from '@/lib/publish-platforms'
|
||||
@@ -17,8 +17,8 @@ const { t } = useI18n()
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const createdRange = ref<[Dayjs, Dayjs] | null>(null)
|
||||
const detailOpen = ref(false)
|
||||
const selectedArticleId = ref<number | null>(null)
|
||||
const articleLinksOpen = ref(false)
|
||||
const selectedTask = ref<InstantTaskItem | null>(null)
|
||||
|
||||
const draftFilters = reactive<{
|
||||
prompt_rule_id?: number
|
||||
@@ -54,6 +54,7 @@ const statusOptions = computed(() => [
|
||||
{ label: getGenerateStatusMeta('queued').label, value: 'queued' },
|
||||
{ label: getGenerateStatusMeta('running').label, value: 'running' },
|
||||
{ label: getGenerateStatusMeta('completed').label, value: 'completed' },
|
||||
{ label: getGenerateStatusMeta('partial_success').label, value: 'partial_success' },
|
||||
{ label: getGenerateStatusMeta('failed').label, value: 'failed' },
|
||||
])
|
||||
|
||||
@@ -135,12 +136,14 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
pageSize.value = nextPageSize
|
||||
}
|
||||
|
||||
function openArticle(task: InstantTaskItem): void {
|
||||
if (!task.article_id) {
|
||||
const selectedTaskArticles = computed(() => selectedTask.value?.articles ?? [])
|
||||
|
||||
function openTaskArticles(task: InstantTaskItem): void {
|
||||
if (!task.articles?.length) {
|
||||
return
|
||||
}
|
||||
selectedArticleId.value = task.article_id
|
||||
detailOpen.value = true
|
||||
selectedTask.value = task
|
||||
articleLinksOpen.value = true
|
||||
}
|
||||
|
||||
function startPolling(): void {
|
||||
@@ -281,8 +284,8 @@ onBeforeUnmount(() => {
|
||||
shape="circle"
|
||||
size="small"
|
||||
class="action-btn action-eye"
|
||||
:disabled="!record.article_id"
|
||||
@click="openArticle(record)"
|
||||
:disabled="!record.articles?.length"
|
||||
@click="openTaskArticles(record)"
|
||||
>
|
||||
<EyeOutlined />
|
||||
</a-button>
|
||||
@@ -293,10 +296,9 @@ onBeforeUnmount(() => {
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<ArticleDetailDrawer
|
||||
:open="detailOpen"
|
||||
:article-id="selectedArticleId"
|
||||
@close="detailOpen = false"
|
||||
<GeneratedArticleLinksDrawer
|
||||
v-model:open="articleLinksOpen"
|
||||
:articles="selectedTaskArticles"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import {
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
EyeOutlined,
|
||||
LoadingOutlined,
|
||||
PauseCircleOutlined,
|
||||
PlayCircleOutlined,
|
||||
} from '@ant-design/icons-vue'
|
||||
@@ -9,12 +11,13 @@ import type { ScheduleTask, ScheduleTaskListParams } from '@geo/shared-types'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query'
|
||||
import { message, type TableColumnsType } from 'ant-design-vue'
|
||||
import type { Dayjs } from 'dayjs'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import GeneratedArticleLinksDrawer from '@/components/GeneratedArticleLinksDrawer.vue'
|
||||
import ScheduleTaskModal from '@/components/ScheduleTaskModal.vue'
|
||||
import { promptRulesApi, schedulesApi } from '@/lib/api'
|
||||
import { formatCronExecutionTime, formatDateTime } from '@/lib/display'
|
||||
import { formatDateTime, getGenerateStatusMeta, hasActiveGenerationStatus } from '@/lib/display'
|
||||
import { formatError } from '@/lib/errors'
|
||||
import { formatPublishPlatformList } from '@/lib/publish-platforms'
|
||||
|
||||
@@ -26,6 +29,8 @@ const editingTask = ref<ScheduleTask | null>(null)
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const createdRange = ref<[Dayjs, Dayjs] | null>(null)
|
||||
const articleLinksOpen = ref(false)
|
||||
const selectedTask = ref<ScheduleTask | null>(null)
|
||||
|
||||
const draftFilters = reactive<{
|
||||
prompt_rule_id?: number
|
||||
@@ -88,11 +93,16 @@ const columns = computed<TableColumnsType<ScheduleTask>>(() => [
|
||||
key: 'prompt_rule_name',
|
||||
width: 180,
|
||||
},
|
||||
{ title: t('custom.instant.executionStatus'), dataIndex: 'status', key: 'status', width: 140 },
|
||||
{
|
||||
title: t('custom.instant.executionStatus'),
|
||||
dataIndex: 'generation_status',
|
||||
key: 'generation_status',
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
title: t('custom.instant.executionTime'),
|
||||
dataIndex: 'cron_expr',
|
||||
key: 'cron_expr',
|
||||
dataIndex: 'execution_time',
|
||||
key: 'execution_time',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
@@ -113,7 +123,7 @@ const columns = computed<TableColumnsType<ScheduleTask>>(() => [
|
||||
key: 'created_at',
|
||||
width: 170,
|
||||
},
|
||||
{ title: t('common.actions'), key: 'actions', width: 140, fixed: 'right', align: 'right' },
|
||||
{ title: t('common.actions'), key: 'actions', width: 176, fixed: 'right', align: 'right' },
|
||||
])
|
||||
|
||||
const removeMutation = useMutation({
|
||||
@@ -165,6 +175,45 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
page.value = nextPage
|
||||
pageSize.value = nextPageSize
|
||||
}
|
||||
|
||||
const selectedTaskArticles = computed(() => selectedTask.value?.generated_articles ?? [])
|
||||
|
||||
function openTaskArticles(task: ScheduleTask): void {
|
||||
selectedTask.value = task
|
||||
articleLinksOpen.value = true
|
||||
}
|
||||
|
||||
let pollingTimer: number | null = null
|
||||
|
||||
function startPolling(): void {
|
||||
if (pollingTimer !== null) return
|
||||
pollingTimer = window.setInterval(() => {
|
||||
void listQuery.refetch()
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
function stopPolling(): void {
|
||||
if (pollingTimer === null) return
|
||||
window.clearInterval(pollingTimer)
|
||||
pollingTimer = null
|
||||
}
|
||||
|
||||
watch(
|
||||
() => listQuery.data.value?.items ?? [],
|
||||
(items) => {
|
||||
const hasActive = items.some((item) => hasActiveGenerationStatus(item.generation_status))
|
||||
if (hasActive) {
|
||||
startPolling()
|
||||
} else {
|
||||
stopPolling()
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
stopPolling()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -240,17 +289,16 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
<template v-if="column.key === 'prompt_rule_name'">
|
||||
{{ record.prompt_rule_name || '--' }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<a-tag :color="record.status === 'enabled' ? 'green' : 'default'">
|
||||
{{
|
||||
record.status === 'enabled'
|
||||
? t('custom.schedule.enabled')
|
||||
: t('custom.schedule.disabled')
|
||||
}}
|
||||
<template v-else-if="column.key === 'generation_status'">
|
||||
<a-tag :color="getGenerateStatusMeta(record.generation_status).color">
|
||||
<span class="task-tab__status">
|
||||
<LoadingOutlined v-if="hasActiveGenerationStatus(record.generation_status)" spin />
|
||||
<span>{{ getGenerateStatusMeta(record.generation_status).label }}</span>
|
||||
</span>
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'cron_expr'">
|
||||
{{ formatCronExecutionTime(record.cron_expr) }}
|
||||
<template v-else-if="column.key === 'execution_time'">
|
||||
{{ formatDateTime(record.execution_time) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'auto_publish_platforms'">
|
||||
<a-tag :color="record.auto_publish ? 'blue' : 'default'">
|
||||
@@ -269,6 +317,19 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<div class="table-actions-row">
|
||||
<a-tooltip :title="t('common.preview')">
|
||||
<span>
|
||||
<a-button
|
||||
type="text"
|
||||
shape="circle"
|
||||
size="small"
|
||||
class="action-btn action-eye"
|
||||
@click="openTaskArticles(record)"
|
||||
>
|
||||
<EyeOutlined />
|
||||
</a-button>
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<a-tooltip :title="t('common.edit')">
|
||||
<a-button
|
||||
type="text"
|
||||
@@ -326,6 +387,10 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
</a-table>
|
||||
|
||||
<ScheduleTaskModal v-model:open="modalOpen" :task="editingTask" />
|
||||
<GeneratedArticleLinksDrawer
|
||||
v-model:open="articleLinksOpen"
|
||||
:articles="selectedTaskArticles"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -362,6 +427,12 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.task-tab__status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 1400px) {
|
||||
.task-tab__filters {
|
||||
grid-template-columns: repeat(2, minmax(260px, 1fr));
|
||||
|
||||
@@ -664,6 +664,8 @@ const enUS = {
|
||||
generating: 'Generating',
|
||||
running: 'Running',
|
||||
completed: 'Completed',
|
||||
partial_success: 'Partially successful',
|
||||
partial_completed: 'Partially successful',
|
||||
failed: 'Failed',
|
||||
},
|
||||
publish: {
|
||||
@@ -1589,6 +1591,9 @@ const enUS = {
|
||||
executionStatus: 'Execution status',
|
||||
executionTime: 'Execution time',
|
||||
createdTime: 'Created time',
|
||||
generatedArticles: 'Generated article links',
|
||||
articleLinksEmpty: 'No generated articles',
|
||||
openArticle: 'Open article',
|
||||
empty: 'No instant tasks yet.',
|
||||
},
|
||||
filters: {
|
||||
|
||||
@@ -634,6 +634,8 @@ const zhCN = {
|
||||
generating: "生成中",
|
||||
running: "运行中",
|
||||
completed: "已完成",
|
||||
partial_success: "部分成功",
|
||||
partial_completed: "部分成功",
|
||||
failed: "生成失败",
|
||||
},
|
||||
publish: {
|
||||
@@ -1508,6 +1510,9 @@ const zhCN = {
|
||||
executionStatus: "执行状态",
|
||||
executionTime: "执行时间",
|
||||
createdTime: "创建时间",
|
||||
generatedArticles: "生成文章链接",
|
||||
articleLinksEmpty: "暂无生成文章",
|
||||
openArticle: "打开文章",
|
||||
empty: "还未创建即时任务,暂无相关数据~",
|
||||
},
|
||||
filters: {
|
||||
|
||||
@@ -8,6 +8,8 @@ const generateStatusMap: Record<string, { label: string; color: string }> = {
|
||||
generating: { label: 'status.generate.generating', color: 'processing' },
|
||||
running: { label: 'status.generate.running', color: 'processing' },
|
||||
completed: { label: 'status.generate.completed', color: 'success' },
|
||||
partial_success: { label: 'status.generate.partial_success', color: 'warning' },
|
||||
partial_completed: { label: 'status.generate.partial_completed', color: 'warning' },
|
||||
failed: { label: 'status.generate.failed', color: 'error' },
|
||||
}
|
||||
|
||||
|
||||
@@ -344,6 +344,12 @@ async function cleanupEmptyFreeCreate(): Promise<void> {
|
||||
}
|
||||
|
||||
function navigateBack(): void {
|
||||
const returnTo = normalizeReturnTo(route.query.return_to)
|
||||
if (returnTo) {
|
||||
void router.push(returnTo)
|
||||
return
|
||||
}
|
||||
|
||||
if (window.history.length > 1) {
|
||||
void router.back()
|
||||
return
|
||||
@@ -352,6 +358,18 @@ function navigateBack(): void {
|
||||
void router.push('/articles/templates')
|
||||
}
|
||||
|
||||
function normalizeReturnTo(value: unknown): string | null {
|
||||
const raw = Array.isArray(value) ? value[0] : value
|
||||
if (typeof raw !== 'string') {
|
||||
return null
|
||||
}
|
||||
const trimmed = raw.trim()
|
||||
if (!trimmed || !trimmed.startsWith('/') || trimmed.startsWith('//')) {
|
||||
return null
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
function handleStay(): void {
|
||||
leaveModalOpen.value = false
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ClockCircleOutlined, ThunderboltOutlined } from '@ant-design/icons-vue'
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import CustomArticleTab from '@/components/CustomArticleTab.vue'
|
||||
import InstantGenerateModal from '@/components/InstantGenerateModal.vue'
|
||||
@@ -11,11 +12,48 @@ import ScheduleTaskModal from '@/components/ScheduleTaskModal.vue'
|
||||
import ScheduleTaskTab from '@/components/ScheduleTaskTab.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const activeTab = ref('articles')
|
||||
const customTabs = ['articles', 'instantTasks', 'scheduleTasks', 'promptRules'] as const
|
||||
type CustomTab = (typeof customTabs)[number]
|
||||
|
||||
const activeTab = ref<CustomTab>(normalizeCustomTab(route.query.tab))
|
||||
const instantModalOpen = ref(false)
|
||||
const scheduleModalOpen = ref(false)
|
||||
|
||||
function normalizeCustomTab(value: unknown): CustomTab {
|
||||
const tab = Array.isArray(value) ? value[0] : value
|
||||
return customTabs.includes(tab as CustomTab) ? (tab as CustomTab) : 'articles'
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query.tab,
|
||||
(tab) => {
|
||||
const normalized = normalizeCustomTab(tab)
|
||||
if (activeTab.value !== normalized) {
|
||||
activeTab.value = normalized
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
watch(
|
||||
activeTab,
|
||||
(tab) => {
|
||||
if (route.query.tab === tab) {
|
||||
return
|
||||
}
|
||||
void router.replace({
|
||||
name: 'articles-custom',
|
||||
query: {
|
||||
...route.query,
|
||||
tab,
|
||||
},
|
||||
})
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
function openInstantModal(): void {
|
||||
instantModalOpen.value = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user