代码之家  ›  专栏  ›  技术社区  ›  mtyson

Vue:vuetify如何使其组件在没有导入的情况下可用?

  •  0
  • mtyson  · 技术社区  · 8 年前

    vuetify 框架中,有一组组件(如滑块等)不需要显式导入即可使用。

    我很好奇vuetify是怎么做到的?

    1 回复  |  直到 8 年前
        1
  •  1
  •   Phiter    8 年前

    你可以查一下 source code .

    Vue.use( 把所有的部件都放在那里。

    import { Vuetify as VuetifyPlugin, VuetifyUseOptions } from 'types'
    
    const Vuetify: VuetifyPlugin = {
      install (Vue: VueConstructor, args?: VuetifyUseOptions): void {
        Vue.use(VuetifyComponent, {
          components,
          directives,
          ...args
        })
      },
    
    推荐文章