当前位置: 首页 > news >正文

网站icp备案代办网站关键词排名查询

网站icp备案代办,网站关键词排名查询,html教程 pdf,学计算机前端好就业吗1.使用ant-design-vue或者element-ui时,如何每个组件都去import导入组件,大大降低了开发效率,如果全局一次性注册会增加项目体积,那么如何实现既不局部引入,也不全局注册? 2.在element-plus官网看到有说明…

1.使用ant-design-vue或者element-ui时,如何每个组件都去import导入组件,大大降低了开发效率,如果全局一次性注册会增加项目体积,那么如何实现既不局部引入,也不全局注册?

2.在element-plus官网看到有说明

3.那么在webpack中也是可以使用的,下载unplugin-auto-import,unplugin-vue-components两款插件

pnpm install -D unplugin-auto-import unplugin-vue-components

4.在vue.config.js中配置

const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { AntDesignVueResolver } = require('unplugin-vue-components/resolvers');AutoImport({imports: ['vue', 'vue-router'],resolvers: [AntDesignVueResolver()],}),Components({resolvers: [AntDesignVueResolver()],}),

5.在项目中使用

<template><div id="app"><!-- <router-view></router-view> --><a-button>按钮</a-button><a-divider /></div>
</template><script>
export default {name: 'App',
}
</script><style>
#app {font-family: Avenir, Helvetica, Arial, sans-serif;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;text-align: center;color: #2c3e50;margin-top: 60px;
}
</style>

6.发现报错:AutoImport is not a function,打印AutoImport发现是个对象,AutoImport.defalut才是函数,更改下vue.config.js配置

AutoImport.defalut({imports: ['vue', 'vue-router'],resolvers: [AntDesignVueResolver()],}),Components.defalut({resolvers: [AntDesignVueResolver()],}),

7.运行项目还是报错
Module build failed (from ./node_modules/.pnpm/unplugin@2.2.0/node_modules/unplugin/dist/webpack/loaders/transform.js): Error [ERR_REQUIRE_ESM]: require() of ES Module

发现插件用的是es语法,而我们用的是commonjs语法,如何解决?降低插件版本
 

"unplugin-auto-import": "0.16.0","unplugin-vue-components": "0.22.0",

8.运行之后发现没报错了,完美解决

9.经过测试,发现在使用a-layout、a-layout-sider组件时,报错:ant-design-vue并没有抛出a-layout-sider,控制台也输出了全部抛出的组件,发现并没有抛出a-lay-sider,包括a-layout-header、a-layout-content、a-layout-footer,去node_modules下查看a-design-vue源码,发现只抛出了a-layout组件,其他四个是通过vue.component全局注册的,所以ant-design-vue不适合用unplugin-auto-import,换成element-ui试下,测试el-menu、el-sub-menu、el-menu-item是否会出现同样的问题呢?

10.经过测试element-ui不会报错,查看源码发现element-ui抛出了所有的组件,比如el-menu、el-menu-item、el-sub-menu,所以想要使用unplugin-auto-import只能使用element-ui。

http://www.mmbaike.com/news/69765.html

相关文章:

  • 手机设计网站站长统计官网
  • 王爷到豆瓣百度关键词怎么优化
  • 千博医院网站模板中小企业管理培训课程
  • 怎样在百度免费做网站外贸网站平台哪个好
  • 怎样做信息收费网站商丘网络推广外包
  • 做外贸出口的网站360优化大师安卓下载
  • 石家庄自适应网站建设谷歌seo课程
  • 在线ui设计网站设计师经常用的网站
  • 织梦网站如何做地区分站网站推广方式组合
  • 做酒吧设计的网站网站策划报告
  • 基于php的网站设计与实现seo网站搭建是什么
  • 网站开发招聘年薪网站关键词排名优化推广软件
  • 临平房产做网站的公司短视频推广策略
  • 档案网站 内容建设百度官网认证申请
  • 一个做网站的团队需要哪些公司模板建站
  • ppt哪个网站做的好友情链接购买
  • 湛江seo建站软文广告经典案例300字
  • 同城免费发布信息网宁波seo深度优化平台有哪些
  • 东莞企业做网站百度直播推广
  • 网站开发功能结构图思维导图vue seo优化
  • 做网站做哪个行业好宁波seo关键词费用
  • 男女做那种的视频网站公司企业网站建设方案
  • 高端网站开发设计手机怎么搭建网站
  • 域名查询站长工具南宁网站建设
  • 网站建设提供排名seo自然优化排名
  • 组态王如何做网站链接网站建站公司
  • 网上做赌博网站吗建立网站用什么软件
  • wordpress建立商业网站广州网页搜索排名提升
  • 网站的策划方案怎么写nba排名2021最新排名
  • 爱网站最新发布址种子搜索引擎torrentkitty