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

Documentation: Layer example not working #146

Open
ni-m opened this issue Mar 28, 2024 · 0 comments
Open

Documentation: Layer example not working #146

ni-m opened this issue Mar 28, 2024 · 0 comments

Comments

@ni-m
Copy link

ni-m commented Mar 28, 2024

Expected behaviour

Using the example from Layers to display a custom background behind the network-graph.

Actual behaviour

The site refuses to load and throws the following error:
Uncaught SyntaxError: Identifier '\__vite__injectQuery' has already been declared (at ${mod.id}:55007:1)

Possible solution

By replacing the :href="withBase('/worldmap.svg')" with :href="'./worldmap.svg'" the side loads as expected and the custom svg is displayed in the background.

I'm not certain what caused the error but with the above adjustments the example works fine.

Example code

<script setup lang="ts">
import { ref } from "vue"
import * as vNG from "v-network-graph"
import { withBase } from "vitepress"
import data from "./data"

// additional layers definition
const layers = {
  // {layername}: {position}
  worldmap: "base",
}

// ref="graph"
const graph = ref<vNG.Instance>()

function onLoadImage() {
  graph.value?.fitToContents()
}
</script>

<template>
  <v-network-graph
    ref="graph"
    :nodes="data.nodes"
    :edges="data.edges"
    :layouts="data.layouts"
    :configs="data.configs"
    :layers="layers"
  >
    <!-- Additional layer -->
    <template #worldmap>
      <image
        :href="withBase('/worldmap.svg')"
        x="0"
        y="0"
        width="1000px"
        @load="onLoadImage"
      />
    </template>
  </v-network-graph>
</template>

Vue version

├─┬ @vitejs/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ @vue/[email protected]
│ │ └─┬ @vue/[email protected]
│ │   └── [email protected] deduped
│ ├─┬ @vueuse/[email protected]
│ │ ├─┬ @vueuse/[email protected]
│ │ │ └─┬ [email protected]
│ │ │   └── [email protected] deduped
│ │ └─┬ [email protected]
│ │   └── [email protected] deduped
│ ├─┬ @vueuse/[email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected] deduped
│ └── [email protected] deduped
└─┬ [email protected]
  └─┬ @vue/[email protected]
    └── [email protected] deduped
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

1 participant