Skip to content

Commit 6623298

Browse files
committed
chore(docs): Update README with section about single file components and reactivemixins options
1 parent ecae747 commit 6623298

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ However you can simply implement this on your own or use one of the two mixins w
165165
Both are included in the `mixins` module.
166166

167167
The mixins automatically create `chartData` as a prop or data. And add a watcher. If data has changed, the chart will update.
168-
However keep in mind the limitations of vue and javascript for mutations on arrays and objects. More info [here](http://vue-chartjs.org/#/home?id=reactive-data)
168+
However keep in mind the limitations of vue and javascript for mutations on arrays and objects.
169+
**It is important that you pass your options in a local variable named `options`!**
170+
The reason is that if the mixin re-renders the chart it calls `this.renderChart(this.chartData, this.options`)` so don't pass in the options object directly or it will be ignored.
171+
172+
More info [here](http://vue-chartjs.org/#/home?id=reactive-data)
169173

170174
```javascript
171175
// MonthlyIncome.js
@@ -229,6 +233,10 @@ export default {
229233
}
230234
```
231235

236+
## Single File Components
237+
238+
You can create your components in Vues single file components. However it is important that you **do not** have the `<template></template>` included. Because Vue can't merge tempaltes. And the template is included in the mixin. If you leave the template tag in your component, it will overwrite the one which comes from the base chart and you will have a blank screen.
239+
232240
## Available Charts
233241

234242
### Bar Chart

0 commit comments

Comments
 (0)