Replies: 4 comments 5 replies
-
You can control the visibility using One way around that would be to pass |
Beta Was this translation helpful? Give feedback.
-
It's not working...🤔 Parent.vue const elements = ref<Elements>([
{
id: '1',
position: { x: 0, y: 0 },
type: 'custom',
// It doesn't matter whether add toolbarVisible here or not,
// also, when adding, the result will be the same whether specify true, false, or undefined.
data: { hello: 'world' },
},
]);
<VueFlow v-model="elements" ...>
<template #node-custom="props">
<CustomNode v-bind="props" />
</template>
</VueFlow> CustomNode.vue const props = withDefaults(
defineProps<{
id: string;
data: any;
}>(),
{}
);
function close() {
props.data.toolbarVisible = false;
setTimeout(() => {
props.data.toolbarVisible = undefined;
}, 1000);
}
<NodeToolbar
:is-visible="props.data.toolbarVisible"
:position="props.data.toolbarPosition"
>
<button @click="close">Close</button>
</NodeToolbar> The toolbar will be removed when (Regarding the direct modification of props in the child component, |
Beta Was this translation helpful? Give feedback.
-
Thank you for your kind explanation. I prepared Stackblitz. Click [Custom Node] to display the toolbar. updateNodeData(props.id, { toolbarVisible: false });
setTimeout(() => {
updateNodeData(props.id, { toolbarVisible: undefined });
}, 1000); If you do this, the toolbar will indeed be hidden when However, the toolbar will be displayed again when I don't want to hide the toolbar temporarily, but rather I want to close the toolbar in the same way as closing a modal, as I no longer need it when the button is clicked. |
Beta Was this translation helpful? Give feedback.
-
I do not want to just temporarily hide the toolbar; I want to completely close it. Sorry for my poor English... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I can click a node to show the toolbar, and then click anywhere else to hide the toolbar.
However, there are probably many situations where the Toolbar is no longer needed after clicking a button on the Toolbar. I would like to hide the Toolbar when the button is clicked.
Even in that case, it seems I still have to click the pane to hide it myself.
<NodeToolbar>
has anis-visible
attribute, but when I set this to false when I wanted to hide it, the Toolbar never appeared again.Beta Was this translation helpful? Give feedback.
All reactions