how to use fabric.js?
-
Is anyone can tell how to use fabric.js ?
I did install fabric,and import fabric already.
but it only show blank page without error. -
You probably want to make it a plugin. You can some examples here: https://forum.quasar-framework.org/topic/2743/suggestion-feedback-from-a-new-user-s-perspective/6
-
I did make it a plugin.
import fabric from 'fabric' export default ({ Vue }) => { Vue.prototype.$fabric = fabric }
then add a test.vue in components.
mounted () { var canvas = new this.$fabric.fabric.Canvas('canvas') var rect = new this.$fabric.fabric.Rect({ left: 100, top: 150, fill: 'red', width: 200, height: 200 }) canvas.add(rect) }
but nothing happened.
-
Have a look here.
https://github.com/sunyatasattva/vue-fabric
It might give you some ideas how to implement fabric.
Scott