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

[VUE-KONVA] Error: Konva error: You may only add layers to the stage. #180

Open
muriloks opened this issue Dec 1, 2021 · 1 comment
Open

Comments

@muriloks
Copy link

muriloks commented Dec 1, 2021

I'm trying to use vue konva on my project, but i'm keeping getting "Error: Konva error: You may only add layers to the stage." even when i have only a layer inside the stage.

<template>
  <div
    v-bind:style="{
      height: '100vh',
      width: '100vw',
      backgroundImage: background
    }"
    ref="container"
  >
    <v-stage
      ref="stage"
      :config="configs.stage"
      @mousedown="stageMouseDown"
      @touchstart="stageMouseDown"
    >
      <v-layer ref="layer">
        <v-image :config="configs.leftPupil" ref="leftPupil" />

        <v-image
          :config="configs.leftPupilDragger"
          ref="leftPupilDragger"
          @dragmove="leftPupilMovement"
        />
        <v-transformer ref="transformer" :config="configs.transformer" />
      </v-layer>
    </v-stage>
  </div>
</template>

That's my code.

index.js:7333 [Vue warn]: Error in mounted hook: "Error: Konva error: You may only add layers to the stage."

found in

--->

/components/Tool.vue

And that's the error.

Using:
"vue": "^2.5.22",
"vue-konva": "^2.1.7",

My index.js


import Vue from 'vue';
import Tool from './components/Tool';
import VueKonva from 'vue-konva';

Vue.use(VueKonva);

console.log('Initializing vue-konva');

new Vue({
    el: "#el",
    components: { Tool },
    template: '<Tool/>'
});
@lavrton
Copy link
Member

lavrton commented Dec 2, 2021

Can you make online demo with codesandbox?

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