vue3-apexcharts icon indicating copy to clipboard operation
vue3-apexcharts copied to clipboard

Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.

Open jrafaaael opened this issue 3 years ago • 3 comments

Hi, there! I get this error (see attached image) when I use the Composition API and the Options API. Said error appears when I edit the script section of my component and save the changes. image

<template>
  <VueApexCharts width="500" type="bar" :options="options" :series="series"></VueApexCharts>
  <button @click="newSeries">new series</button>
</template>

<script>
import VueApexCharts from "vue3-apexcharts";

import { ref } from "@vue/reactivity";

export default {
  name: "App",
  components: {
    VueApexCharts,
  },
  setup() {
    const options = ref({
      chart: {
        id: "vuechart-example",
      },
      xaxis: {
        categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998],
      },
    });
    const series = ref([
      {
        name: "series-1",
        data: [30, 40, 45, 50, 49, 60, 70, 91],
      },
    ]);

    const newSeries = () => {
      const max = 90;
      const min = 45;
      const newData = series.value[0].data.map(() => {
        return Math.floor(Math.random() * (max - min + 1)) + min;
      });
      series.value = [
        {
          data: newData,
        },
      ];
    };
    return {
      newSeries,
      options,
      series,
    };
  },
};
</script>

<style></style>

jrafaaael avatar Jun 28 '21 03:06 jrafaaael

I get the same error when mounting and unmounting the component using the v-if directive

markusand avatar Sep 24 '21 18:09 markusand

I am also getting the same issue. Has anyone got the solution?

Atif-Bashir-1998 avatar Sep 25 '21 11:09 Atif-Bashir-1998

@jrafaaael @junedchhipa I think this issue occur from Vue3 or this version not full compatible with Vue 3.x, try wrap your template with div tag same with Vue2:

<template>
  <div>
     <VueApexCharts width="500" type="bar" :options="options" :series="series"></VueApexCharts>
     <button @click="newSeries">new series</button>
  </div>
</template>

It work well for me. Live reload after change from SFC(Single File Component) still work well!

giapdong avatar Oct 13 '21 16:10 giapdong