mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
simplify data usage
This commit is contained in:
1 parent
4033eefa0d
commit
c2c100e6e6
1 file changed
+12
-19
@@ -17,15 +17,16 @@ const marginY = 120
|
||||
|
||||
const nodeWidth = 160
|
||||
const nodeHeight = 50
|
||||
const opened = ref<Node>({
|
||||
id: '',
|
||||
title: '',
|
||||
x: 0,
|
||||
y: 0,
|
||||
index: 0,
|
||||
completed: false,
|
||||
unlocked: false,
|
||||
})
|
||||
// const opened = ref<Node>({
|
||||
// id: '',
|
||||
// title: '',
|
||||
// x: 0,
|
||||
// y: 0,
|
||||
// index: 0,
|
||||
// completed: false,
|
||||
// unlocked: false,
|
||||
// })
|
||||
const opened = ref<Node | null>(null)
|
||||
type Node = {
|
||||
id: string
|
||||
title: string
|
||||
@@ -113,15 +114,7 @@ function handleNodeClick(node: Node) {
|
||||
}
|
||||
function closeIntro(close: boolean) {
|
||||
if (close) {
|
||||
opened.value = {
|
||||
id: '',
|
||||
title: '',
|
||||
x: 0,
|
||||
y: 0,
|
||||
index: 0,
|
||||
completed: false,
|
||||
unlocked: false,
|
||||
}
|
||||
opened.value = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +212,7 @@ const edgeStyle = computed(() => {
|
||||
:questTitle="opened.title"
|
||||
:questId="opened.id"
|
||||
:questUnlocked="opened.unlocked"
|
||||
v-if="opened.id !== ''"
|
||||
v-if="opened"
|
||||
@close-intro="closeIntro"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user