vant4_开发记录

安装

在vue3中安装

yarn add vant

安装按需引入插件

yarn add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import -D

配置按需引入插件

// vite.config.js
// 配置vant4按需引入插件
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver'

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
	// 其它代码
})
posted @ 2024-04-26 00:02  Syinho  阅读(74)  评论(0编辑  收藏  举报