1 installation
Personally prefer NPM or YARN installation
Vue 2 project, install Vant 2.x version: NPM I Vant -s YARN add VantCopy the code
Vue 3 project, install Vant 3.x: NPM I vant@next -s YARN add vant@nextCopy the code
2 the introduction of
Introduction on demand is strongly recommended
NPM I ts-import-plugin-s // NPM I ts-import-plugin-sCopy the code
Webpack 1 does not need to set libraryDirectory {"plugins": [["import", {"libraryName": "vant", "libraryDirectory": "es", "style": Module.exports = {plugins: [['import', {libraryName: {plugins: ['import', {libraryName: {plugins: ['import', {libraryName: {plugins: {plugins: {plugins: ['import', {libraryName: {plugins: {plugins: {plugins: {plugins: ['import', {libraryName:}}} 'vant', libraryDirectory: 'es', style: true }, 'vant'] ] }; / / the vue project in vue. Config. Js configured in configureWebpack: {module: {rules: [{test: / \. (JSX | TSX | js | ts) $/, loader: 'ts-loader', options: { transpileOnly: true, getCustomTransformers: () => ({ before: [tsImportPluginFactory({ libraryName: 'vant', libraryDirectory: 'lib', style: true })] }), compilerOptions: { module: 'es2015' } }, exclude: /node_modules/ } ] }, },Copy the code