Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Remove Vue.extend() #201

Closed
4 tasks done
apertureless opened this issue Sep 16, 2017 · 5 comments
Closed
4 tasks done

🔥 Remove Vue.extend() #201

apertureless opened this issue Sep 16, 2017 · 5 comments

Comments

@apertureless
Copy link
Owner

apertureless commented Sep 16, 2017

Current state

The Base Charts are using the Vue.extend() which creates a subclass of the base vue constructor.

This way if you create your own components, you can extend the base component.

import {Line} from 'vue-chartjs'

export default Line.extend({
 mounted () {
    this.renderChart(data, options)
  }
})

I really liked the concept back then ( Jun 2016 first commit 😄 ). However it creates a lot of confusion to people new to Vue.js

And it is not really nessasary.

Proposal

To clean up the API and usage the Vue.extend() should be removed. And extending the base component should be done with either extends or mixins

This way, your component would look like this:

import {Line} from 'vue-chartjs'

export default {
 extends: Line,
 mounted () {
    this.renderChart(data, options)
  }
}

or

import {Line} from 'vue-chartjs'

export default {
 mixins: [Line],
 mounted () {
    this.renderChart(data, options)
  }
}

This way own components would be standard vue component style.
It is a breaking change, but without much efford to fix.

Scheduled for v3

Another benefit would be the decreased size, as the old version needs the base vue constructor, and bundle vue into it.

Todo

Testing

yarn add vue-chartjs@next

@apertureless apertureless added this to the 3.0 milestone Sep 16, 2017
@apertureless apertureless self-assigned this Sep 16, 2017
@apertureless apertureless changed the title Remove Vue.extend() 🔥 Remove Vue.extend() Sep 16, 2017
@kimuraz
Copy link

kimuraz commented Oct 2, 2017

May I take this one @apertureless ?

@apertureless
Copy link
Owner Author

Hey @kimuraz

well it's already done. https://github.com/apertureless/vue-chartjs/tree/feature/v3

But needs some testing and I need to update the docs. Thats why this issue is still open.

@kimuraz
Copy link

kimuraz commented Oct 4, 2017

That's ok, if I can be useful in any of these tasks, let me know.

I can also update the docs translation (pt-br) for the new version. Is it ok?

@huangche007
Copy link

this change is so cool

@amitmeghare
Copy link

its cool...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants