Skip to content

Document is not defined with Nuxt.js #82

Open
@JoepOomens

Description

@JoepOomens

When I use the Tree component in Nuxt.js, I get the 'document is not defined' error when opening the page. I guess it has to do with the SSR in Nuxt, but the error still exists with the tag.

Has somebody solved this issue?

<template>
	<no-ssr>
		<Tree :data="list" draggable="draggable" cross-tree="cross-tree">
			<div slot-scope="{ data, store }">
				<template v-if="!list.isDragPlaceHolder"
					><b v-if="list.children && list.children.length" @click="store.toggleOpen(list)">
						{{ list.open ? '-' : '+' }} </b
					><span>{{ list.text }}</span>
				</template>
			</div>
		</Tree>
	</no-ssr>
</template>

<script>
import { Tree} from 'vue-draggable-nested-tree';
export default {
	components: {
		Tree,
	},
	computed: {
		list() {
			return [
				{ text: '123' },
				{ text: '456', children: [{ text: '456-123' }] },
				{
					text: '789',
					children: [
						{
							text: '789-123',
							children: [{ text: '789-123-123' }],
						},
						{
							text: '789-456',
						},
					],
				},
			];
		},
	},
};
</script>```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions