GithubHelp home page GithubHelp logo

I have a question? about vue-fabric HOT 6 CLOSED

purestart avatar purestart commented on June 23, 2024
I have a question?

from vue-fabric.

Comments (6)

purestart avatar purestart commented on June 23, 2024

you should add ref="canvas" in fabric component and please updated vue-fabric at latest version 0.1.15
such as:
<vue-fabric ref="canvas" :width="width" :height="height"></vue-fabric>

usage:
this.$refs.canvas.createTriangle(params)

from vue-fabric.

happyzhanhan avatar happyzhanhan commented on June 23, 2024

Error in created hook: "TypeError: Cannot read property 'createTriangle' of undefined".

from vue-fabric.

purestart avatar purestart commented on June 23, 2024

please attach your code !!

from vue-fabric.

purestart avatar purestart commented on June 23, 2024
let options = {
  x: 50,
  y: 120,
  x1: 80,
  y1: 140,
  x2: 30,
  y2: 60,
  color: "#F00",
  drawWidth: 2
}
this.$refs.canvas.createTriangle(options)

from vue-fabric.

happyzhanhan avatar happyzhanhan commented on June 23, 2024

thank you very much! I found the problem.
eg.
methods:{
init(){
/console.log(this.$refs.canvas);
this.$refs.canvas.createRect({
width: 20,
height: 30,
fillColor: 'blue',
left: 50,
top: 50
});
/
//this.$refs.input1.value="2222";

  console.log(this.$refs);
  console.log(this.$refs.input1);
  console.log(this.$refs.canvas);

},
inputchange(){
  console.log(11111111111);
  console.log(this.$refs);
  console.log(this.$refs.input1);
   console.log(this.$refs.canvas);
}

}

from vue-fabric.

happyzhanhan avatar happyzhanhan commented on June 23, 2024

need write in mounted(){}.

from vue-fabric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.