What are a-la-carte components? Should I use it?

When starting a new project using vue-cli, he asks a few questions for setting up the installation. Typically, the name of the project, a description of whether to use eslint for linting, karma and mocha for testing, etc. This time he asked me

? Use a-la-carte components?

I searched for it in the Vue-Cli docs but didn't find anything. So can someone tell me what a la carte is and should I use it?

+14
source share
4 answers

- , " ". ", , ".

, , , , ( ) , ,

Vuetify:

Vuetify , , .

import {
 Vuetify,
 VApp,
 VNavigationDrawer,
 VFooter,
 VList,
 VBtn
} from 'vuetify'

Vue.use(Vuetify, {
 components: {
   VApp,
   VNavigationDrawer,
   VFooter,
   VList,
   VBtn
 }
})

2018/11/14:

1.3.0,
vuetify-loader ( vuetify cli install)
, , Vuetify .

+19

, , vuetify. " ", /plugins/vuetify.js :

import Vue from 'vue'
import {
 Vuetify,
 VApp,
 //other vuetify components
} from 'vuetify'

Vue.use(Vuetify, {
 components: {
   VApp,
   //other vuetify components
 }
})

babel.config.js vuetify "transform-import".

-, vuetify v1.3.0-alpha.0 "--" , -, , vuetify, . , Webpack "-- ".

, vuetify 1.3.0-alpha.0, , --, Webpack 4 ( AKA) vuetify-loader., , vuetify, "-- ".

, ( --), - , . vue-cli 3 :

  • vuetify dev: npm install -D vuetify-loader
  • vuetify 'vuetify/lib' 'vuetify' vuetify.js.

:

import Vue from 'vue'
import Vuetify from 'vuetify/lib'

Vue.use(Vuetify)
  • vuetify-loader vue.config.js vue.config.js ( , ).

:

const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')

module.exports = {
   configureWebpack: {
     plugins: [
        new VuetifyLoaderPlugin(),
    ]
   }
 // ...other vue-cli plugin options...
} 
  • a-la-carte, "transform-import" babel ( babel.config.js)

  • , , , --watch --mode development npm run build, ,

,

+6

Using vuetify-loader, do we need to explicitly import components and directives? Is it good to import again and again? if I'm wrong, correct me and give an example that will help me more. thanks

0
source

All Articles