# Guide

# Getting Started

Vue-Fabric-Wrapper provides a number of components that allow you to render a Fabric.js canvas.

# Setup

npm install vue-fabric-wrapper
1

Add it to your application

import vueFabricWrapper from "vue-fabric-wrapper";
1

# How to use in Vue

<template>
  <div id="app">
    <fabric-canvas>
      <fabric-circle :id="3"></fabric-circle>
    </fabric-canvas>
  </div>
</template>

<script>
import vueFabricWrapper from "vue-fabric-wrapper";

export default {
  name: "App",
  components: {
    FabricCanvas: vueFabricWrapper.FabricCanvas,
    FabricCircle: vueFabricWrapper.FabricCircle
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# How to use in Nuxt

Create Plugin with the following example code

import Vue from 'vue';
import vueFabricWrapper from 'vue-fabric-wrapper';

Vue.component("FabricCanvas", vueFabricWrapper.FabricCanvas)
Vue.component("FabricCircle", vueFabricWrapper.FabricCircle)
1
2
3
4
5

Add this to nuxt.config and use mode client

module.exports = {
	plugins: [
			{ src: "@/plugins/fabric.js", mode: "client" }
		]
}
1
2
3
4
5

Finally use client-only to render only on the client side

<template>
  <client-only>
    <fabric-canvas>
      <fabric-circle :id="2"></fabric-circle>
    </fabric-canvas>
  </client-only>
</template>

<script>
export default {

};
</script>

<style>
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# Show Your Support

Please give a ⭐️ if this project helped you!

# Contributing

If you have any questions or requests or want to contribute to vue-fabric-wrapper or other packages, please write the issue or give me a Pull Request freely.

# Bug Report

If you find a bug, please report to us opening a new Issue on GitHub.

Last Updated: 11/27/2019, 11:19:46 AM