Vue binding to canvas element via Konva framework
npm install vue3-konvaVue Konva is a JavaScript library for drawing complex canvas graphics using Vue.
It provides declarative and reactive bindings to the Konva Framework.
All vue-konva components correspond to Konva components of the same name with the prefix 'v-'. All the parameters available for Konva objects can add as config in the prop for corresponding vue-konva components.
Core shapes are: v-rect, v-circle, v-ellipse, v-line, v-image, v-text, v-text-path, v-star, v-label, v-path, v-regular-polygon.
Also you can create custom shape.
To get more info about Konva you can read Konva Overview.
See Tutorials page
Vue.js version 2.4+ is required.
npm
npm install vue-konva konva --save
`$3
`javascript
import Vue from 'vue';
import VueKonva from 'vue-konva'Vue.use(VueKonva)
`$3
`html
`
`javascript
`$3
`html
`Core API
Getting reference to Konva objects
You can use
ref feature from vue.`html
ref="rect"
/>
`$3
By default
vue-konva works in "non-strict" mode. If you changed a property manually (or by user action like drag&drop) properties of the node will be not matched with properties passed as config. vue-konva updates ONLY changed properties.In strict mode
vue-konva will update all properties of the nodes to the values that you provided in config, no matter changed they or not.You should decide what mode is better in your actual use case.
To enable strict mode pass __useStrictMode attribute:
`html
`
Configurable prefix
By default
vue-konva is using v- prefix for all components.You can use your own prefix if default one conflicts with some other libs or your components.
`javascript
import Vue from 'vue';
import VueKonva from 'vue-konva'Vue.use(VueKonva, { prefix: 'Konva'});
// in template:
``The change log can be found on the Releases page.