Comments (6)
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.
Error in created hook: "TypeError: Cannot read property 'createTriangle' of undefined".
from vue-fabric.
please attach your code !!
from vue-fabric.
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.
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.
need write in mounted(){}.
from vue-fabric.
Related Issues (20)
- 如何做到将组件拖入画布呢 HOT 1
- 希望能支持触摸屏上的touch 鼠标事件还是延迟还高了 HOT 1
- 大佬node-pre-gyp WARN Using request for node-pre-gyp https download gyp ERR! find Python 怎么回事啊 HOT 1
- 一个页面使用两个vue-fabric时候第二个vue-fabric没有渲染成功 HOT 1
- setting crossOrigin: 'anonymous'
- id = canvas的情况下会报错,应该可以屏蔽这个问题 HOT 1
- Mirror working only on image objects HOT 1
- 你好,能支持撤销操作吗,比如前进一步,后退一步 HOT 1
- 增加橡皮擦功能 HOT 1
- createTextbox 如何设置字体?
- 请问这个控制的边框的蓝色要如何去掉
- IText 支持的吗
- 怎么禁止选中图片啊? HOT 1
- this.$refs.canvas.createImage绘制图片时设置top无效
- fabric 4.0.0即将发布,是否有适配计划?
- 支持滚轮缩放、平移吗
- createCircle Stroke colour HOT 5
- not working on vue3
- uniapp中怎么使用vue-fabric
- 使用 this.$refs.canvas.todataurl()只会保存上一次操作的图片
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-fabric.