Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue on fold and unfold, dropDisable options #117

Open
MuthuSelviC opened this issue Jul 25, 2024 · 2 comments
Open

Issue on fold and unfold, dropDisable options #117

MuthuSelviC opened this issue Jul 25, 2024 · 2 comments

Comments

@MuthuSelviC
Copy link

MuthuSelviC commented Jul 25, 2024

In the testData array object, I added the open property. But It open all the nodes at initially. Also, I added disableDrop property. But I can drop the nodes.

<template>
	<div>Test tree
		<Draggable
			v-model="testData"
			treeLine>
			<template #default="{ node, stat }">
				<button @click="stat.open = !stat.open">
					{{ stat.open ? '-' : '+' }}
				</button>
				{{ node.text }}
			</template>
		</Draggable>
	</div>
</template>

<script>
import {Draggable} from '@he-tree/vue';
import '@he-tree/vue/style/default.css';

export default {
	name       : 'TestTree',
	components : { Draggable },
	data () {
		return {
			testData   : [],
			selectedId : null
		};
	},
	mounted () {
		this.testData = [
			{
				id       : 1,
				text     : 'Item 1',
				open     : true,
				children : [
					{ id : 2, text : 'Child 1-1', open : false, disableDrop : true },
					{ id : 3, text : 'Child 1-2', open : false, disableDrop : true }
				]
			},
			{
				id       : 4,
				text     : 'Item 2',
				open     : false,
				children : [
					{ id : 5, text : 'Child 2-1', open : false },
					{ id : 6, text : 'Child 2-2', open : false }
				]
			}
		];
	}
};
</script>

Anyone please check this issue. Could you tell me what I did wrong?

@phphe
Copy link
Owner

phphe commented Jul 25, 2024

@MuthuSelviC
Copy link
Author

Thanks. It works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants