Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  79] [ 3]  / answers: 1 / hits: 15576  / 7 Years ago, mon, february 20, 2017, 12:00:00

I just came across the same combination: Fabric.js and Vue.js and was wondering, but I'm working with VueJs few days and I don't know how to set up fabric in vue.

Can you share some experience for me?


More From » vue.js

 Answers
17

Assuming you're using ES6 and a bundler such as Webpack you can start using Fabric.js as follows:



At the command line



npm install fabric


or



yarn add fabric


Then import it in your .js file.



import { fabric } from 'fabric'


Then set up your Canvas in Vue's mounted: method.



Note: For me the default fabric npm module resulted in quite a large package. I ended up using the fabric-browseronly module instead. Fabric.js has a lot of features you might not need, in which case you could build your own version here or via the command line.


[#58859] Saturday, February 18, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zariahdiamondz

Total Points: 649
Total Questions: 109
Total Answers: 88

Location: Tajikistan
Member since Thu, Apr 14, 2022
2 Years ago
;