Leo Song commited on
Commit ·
8daa254
1
Parent(s): db0ac89
Update PublishCenter.vue
Browse files
sau_frontend/src/views/PublishCenter.vue
CHANGED
|
@@ -529,9 +529,19 @@ const defaultTabInit = {
|
|
| 529 |
publishStatus: null // 发布状态,包含message和type
|
| 530 |
}
|
| 531 |
|
| 532 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
const tabs = reactive([
|
| 534 |
-
|
| 535 |
])
|
| 536 |
|
| 537 |
// 账号相关状态
|
|
@@ -568,9 +578,9 @@ const recommendedTopics = [
|
|
| 568 |
// 添加新tab
|
| 569 |
const addTab = () => {
|
| 570 |
tabCounter++
|
| 571 |
-
const newTab =
|
| 572 |
-
newTab
|
| 573 |
-
newTab
|
| 574 |
tabs.push(newTab)
|
| 575 |
activeTab.value = newTab.name
|
| 576 |
}
|
|
|
|
| 529 |
publishStatus: null // 发布状态,包含message和type
|
| 530 |
}
|
| 531 |
|
| 532 |
+
// helper to create a fresh deep-copied tab from defaultTabInit
|
| 533 |
+
const makeNewTab = () => {
|
| 534 |
+
// prefer structuredClone when available (newer browsers/node), fallback to JSON
|
| 535 |
+
try {
|
| 536 |
+
return typeof structuredClone === 'function' ? structuredClone(defaultTabInit) : JSON.parse(JSON.stringify(defaultTabInit))
|
| 537 |
+
} catch (e) {
|
| 538 |
+
return JSON.parse(JSON.stringify(defaultTabInit))
|
| 539 |
+
}
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
// tab页数据 - 默认只有一个tab (use deep copy to avoid shared refs)
|
| 543 |
const tabs = reactive([
|
| 544 |
+
makeNewTab()
|
| 545 |
])
|
| 546 |
|
| 547 |
// 账号相关状态
|
|
|
|
| 578 |
// 添加新tab
|
| 579 |
const addTab = () => {
|
| 580 |
tabCounter++
|
| 581 |
+
const newTab = makeNewTab()
|
| 582 |
+
newTab.name = `tab${tabCounter}`
|
| 583 |
+
newTab.label = `发布${tabCounter}`
|
| 584 |
tabs.push(newTab)
|
| 585 |
activeTab.value = newTab.name
|
| 586 |
}
|