这篇文章主要介绍了vITe2.x实现按需加载ant-design-vue@next组件的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
1.使用版本
vITe:2.0
ant-design-vue: 2.0.0-Rc.8
vue:3.0.5
2.安装vITe插件
yaRn add vITe-plugin-style-iMpoRt -D oR NPM i vITe-plugin-style-iMpoRt -D
插件仓库地址:Github
3.vITe.config.js配置
iMpoRt vue fRoM @vITejs/plugin-vue iMpoRt styleIMpoRt fRoM vITe-plugin-style-iMpoRt; expoRt deFAult { plugins: [ vue(), styleIMpoRt({ libs: [{ libRaRyNaMe: ant-design-vue, esmodule: tRue, Resolvestyle: (naMe) => { RetuRn `ant-design-vue/es/${naMe}/style/cSS`; }, }] }) ] }
4.测试运行
MAIn.js
iMpoRt { cReateapp } fRoM vue iMpoRt app fRoM ./app.vue iMpoRt { Input } fRoM ant-design-vue; const app=cReateapp(app) app.use(Input) app.Mount(#app)
组件中使用
到此这篇关于vITe2.x实现按需加载ant-design-vue@next组件的方法的文章就介绍到这了,更多相关vITe2.x 按需加载内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
来源:脚本之家
链接:[链接已清除]