hilongjw / vue-recyclerview

Mastering Large Lists with the vue-recyclerview
https://hilongjw.github.io/vue-recyclerview/
MIT License
1.45k stars 121 forks source link

Simplified usage #3

Closed egoist closed 7 years ago

egoist commented 7 years ago

I find it a little verbose and unnecessary to use this component like:

components: {
   RecyclerView: RecyclerView(Vue)
}

Instead, maybe introduce a simplified usage, as plugin:

import Vue from 'vue'
import { recyclerview } from 'recyclerview'

Vue.use(recyclerview)

As local component:

import { RecyclerView } from 'recyclerview'

export default {
  components: { RecyclerView }
}

As global component:

import Vue from 'vue'
import { RecyclerView } from 'recyclerview'

Vue.component(RecyclerView.name, RecyclerView)
hilongjw commented 7 years ago

it support plugin installation now. RecyclerView need Vue to create instance to render item of list, I think maybe the plugin would be better.

import Vue from 'vue'
import recyclerview from 'recyclerview'

Vue.use(recyclerview)
export default {
  components: { RecyclerView }
}
egoist commented 7 years ago

Thanks for the reply, sounds fair enough, it could be better if we can directly import the component for local registration, you can access Vue via import Vue from 'vue' directly. Anyways this is not an issue, closing :D