mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Added append setting to trees
This commit is contained in:
parent
adf7d7a67c
commit
4f23e2a264
3 changed files with 14 additions and 5 deletions
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div v-frag>
|
||||
<span class="row" v-for="(row, index) in rows" :key="index">
|
||||
<tree-node v-for="(node, nodeIndex) in row" :key="nodeIndex" :id="node" @show-modal="openModal" />
|
||||
<tree-node v-for="(node, nodeIndex) in row" :key="nodeIndex" :id="node" @show-modal="openModal" :append="append" />
|
||||
</span>
|
||||
<span class="side-nodes" v-if="rows.side">
|
||||
<tree-node v-for="(node, nodeIndex) in rows.side" :key="nodeIndex" :id="node" @show-modal="openModal" small />
|
||||
<tree-node v-for="(node, nodeIndex) in rows.side" :key="nodeIndex" :id="node" @show-modal="openModal" :append="append" small />
|
||||
</span>
|
||||
<modal :show="showModal" @close="closeModal">
|
||||
<div slot="header"><h2 v-if="modalHeader">{{ modalHeader }}</h2></div>
|
||||
|
@ -26,7 +26,8 @@ export default {
|
|||
};
|
||||
},
|
||||
props: {
|
||||
nodes: Array
|
||||
nodes: Array,
|
||||
append: Boolean
|
||||
},
|
||||
inject: [ 'tab' ],
|
||||
computed: {
|
||||
|
|
|
@ -31,7 +31,8 @@ export default {
|
|||
name: 'tree-node',
|
||||
props: {
|
||||
id: [ String, Number ],
|
||||
small: Boolean
|
||||
small: Boolean,
|
||||
append: Boolean
|
||||
},
|
||||
inject: [ 'tab' ],
|
||||
computed: {
|
||||
|
@ -94,6 +95,13 @@ export default {
|
|||
this.layer.onClick();
|
||||
} else if (this.layer.modal) {
|
||||
this.$emit('show-modal', this.id);
|
||||
} else if (this.append) {
|
||||
if (player.tabs.includes(this.id)) {
|
||||
const index = player.tabs.lastIndexOf(this.id);
|
||||
player.tabs = [...player.tabs.slice(0, index), ...player.tabs.slice(index + 1)];
|
||||
} else {
|
||||
player.tabs = [...player.tabs, this.id];
|
||||
}
|
||||
} else {
|
||||
player.tabs = [...player.tabs.slice(0, this.tab.index + 1), this.id];
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ const spook = {
|
|||
|
||||
const main = {
|
||||
id: 'main',
|
||||
display: '<tree />'
|
||||
display: '<tree append="true" />'
|
||||
}
|
||||
|
||||
export const initialLayers = [ main, f, c, a, g, h, spook ];
|
||||
|
|
Loading…
Reference in a new issue