Skip to content

StriverF/vant-ui-demo

Repository files navigation

vant-ui-demo

Build Setup

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm run start

# generate static project
$ npm run generate

按需引入Vant / Ant Design Vue 组件库(样式也按需引入)

需要注意的是 Nuxt的nuxt.config.js配置里面的 plugins 第三方库引入配置是全局引入,不是按页面按需引入。 包括nuxt.config.jscss也是一样全局引入。

为了按需引入样式和组件需要配置nuxt.config.js的 [build]{https://zh.nuxtjs.org/api/configuration-build/}配置项

export default {
  build: {
    babel: {
      plugins: [
        [
          'import',
          {
            libraryName: 'vant',
            style: (name) => {
              return `${name}/index.css`
            },
          },
        ],
      ]
    }
  }
}

For detailed explanation on how things work, check out Nuxt.js docs.

About

Nuxt.js 按需引入Vant和Ant Design组件库

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published