use Vue in a simpler way.
vue-auto
can help you inject all components automatically, It makes your project simpler, cleaner.
No Import.
No Vue.component
.
No component.name
.
No Router.component
.
install: npm i vue-auto
or yarn add vue-auto
.
create components/
and pages/
folder.
import to your main.js
:
import Vue from 'vue'
import { install } from 'vue-auto'
install(Vue)
Any component will be automatically injected into the global, you can also customize component prefixe.
import Vue from 'vue'
import Router from 'vue-router'
import { withRouters } from 'vue-auto'
Vue.use(Router)
export default new Router({
routes: withRouters([
{ path: '/', name: 'home' },
{ path: '/about', name: 'about' },
])
})
install: (vue: Vue, options: { prefix: string }) => void
withRouter: (Array<VueRoute>) => Routers