问题描述:

安装了vant 3以上版本,在vue2引入vant组件库不生效,报错:

ERROR in ./node_modules/@vant/use/dist/index.esm.mjs 101:12-19
export 'isVNode' (imported as 'isVNode') was not found in 'vue'

解决方法:

卸载后重装 vant2.12.2即可

vant2 自动按需引入

vant2的官方文档:

https://vant-ui.github.io/vant/v2/#/zh-CN/quickstart

1. 安装插件:babel-plugin-import -D

npm i babel-plugin-import -D

或 yarn add babel-plugin-import -D

2.配置

根据自己的实际情况配置,我是第二种

// 在.babelrc 中添加配置
// 注意:webpack 1 无需设置 libraryDirectory
{"plugins": [["import", {"libraryName": "vant","libraryDirectory": "es","style": true}]]
}// 对于使用 babel7 的用户,可以在 babel.config.js 中配置
module.exports = {plugins: [['import', {libraryName: 'vant',libraryDirectory: 'es',style: true}, 'vant']]
};

3.注册

根据自己所需,选择其中一种方式注册

3.1 全局注册

在main.js 里引入并注册所需的vant组件

import {Button} from 'vant'
Vue.use(Button)//全局注册

3.2 在所需页面注册

<script>
import {Button} from 'vant'
export default {// 注册组件components:{vanButton:Button}
}
</script>

vue2 vant组件库报错:ERROR in ./node_modules/@vant/use/dist/index.esm.mjs 101:12-19export ‘isVNode‘ (imp相关推荐

  1. 【mars3d+vue2】项目打包报错 error in ./node_modules/mars3d-cesium/Build/Cesium/index.js

    最近拉下 mars3d+vue2  最简模板的代码,运行就会报错 类似这种cesium的报错 官方给出的回答是: 目前cesium1.96改变了代码打包方式,在vue2项目下会有这个兼容报错问题. 当 ...

  2. git pull 报错 error: cannot pull with rebase: Your index contains uncommitted changes.

    git pull 报错 error: cannot pull with rebase: Your index contains uncommitted changes. error: please c ...

  3. vant组件引入报错module “pages/index/initiate/path/to/@vant/weapp/dist/dialog/dialog.js“ is not defined

    问题描述 根据官方文档引入dialog弹出框引入报错: 使用vant组件库的dialog弹出框引入报错 原因分析: 不能直接根据官网的路径直接写path/to,而是要使用你安装本地的dialog.js ...

  4. 【错误记录】Python 安装依赖库报错 ( ERROR: Could not find a version that satisfies the requirement elftools )

    文章目录 一.报错信息 二.解决方案 一.报错信息 报错信息 : ERROR: Could not find a version that satisfies the requirement elft ...

  5. 运行ant-design-pro报错ERROR in ./node_modules/swagger-ui-react/swagger-ui.js 2:107055-107070Module not

    报错内容:  ERROR in ./node_modules/swagger-ui-react/swagger-ui.js 2:107055-107070 Module not found: Erro ...

  6. vscode报错ERROR in node_modules/@types/node/ts3.5/globals.global.d.ts:1:13 - error TS2403: Subsequent

    报错信息 ERROR in node_modules/@types/node/ts3.5/globals.global.d.ts:1:13 - error TS2403: Subsequent var ...

  7. 启动阿里低代码平台报错 error in ./node_modules/@alifd/next/es/grid/main.scss

    第一次使用阿里巴巴的低代码平台,在简单绘制了几个组件后,准备导出来在本地运行起来,按照readme先安装了npm相关的包,但在启动后一直有这个报错,看了github上一些解决方式,都是让修改@alif ...

  8. Vant 组件库(VUE)的使用 Vant滚动选择器 选择器 传值

    在 vue- cli 项目中安装  官方文档链接 npm ( 后面内容需要在控制台终端输入) # 通过 npm 安装 npm i vant -S 自动按需引入组件:babel-plugin-impor ...

  9. 当在 终端 中用 npm 安装 Vant 组件库时,发生“npm ERR code ERESOLVE ;npm ERRERESOLVE could not resolve;”报错时,该怎么办?

    出现的问题: 当在 终端 中用 npm 安装 Vant 组件库时,发生 npm ERR! code ERESOLVE: npm ERR! ERESOLVE could not resolve:报错时, ...

  10. python下载第三方库的时候报错ERROR: Command errored out with exit status 1: python setup.py egg_info Check the

    python下载第三方库的时候报错ERROR: Command errored out with exit status 1: python setup.py egg_info Check the l ...

最新文章

  1. python pandas rename_使用Pandas重命名文件
  2. Django用来作为爬虫框架浅谈
  3. ASP.NET2.0中的ClientScriptManager 类用法—如何添加客户端事件
  4. oracle9i在window server 2003 sp2 企业版突破1.7G内存限制
  5. 《你不常用的c#之二》:略谈GCHandle
  6. UIView设置背景渐变色
  7. 课节5:图神经网络算法(二):图采样
  8. java面试_数据库
  9. 【Win10安装字体+免费字体库】Windows10安装新字体教程,免费在线字体库推荐
  10. 怎么选择boost升压电路的电感?只要三个公式
  11. 开关电源测试软件有哪些,开关电源的测试项目大全,你确定都知道?
  12. 净利同比下滑14.5%,康师傅的“水”和“面”还好卖吗?
  13. 洛克菲勒留给儿子的38封信
  14. mac更新系统后xcode问题
  15. Java:一个帝国的诞生(请仔细看完,你会感叹这是一个奇迹)
  16. Android蓝牙打印机功能开发完整Demo
  17. 标准正态分布+标准正态分布概率表+分布函数+积分
  18. C++:GCC编译:GCC编译C++程序分步流程
  19. 奥斯卡影帝马修·麦康纳给毕业生的话
  20. 基础知识-计算机网络-应用层

热门文章

  1. 先有鸡还是先有蛋的定论
  2. 心无界,牧云端:华为云与人工智能的野望
  3. C++继承中的构造函数—计算圆柱体的表面积(函数名隐藏)
  4. [读书笔记—学习方法]《深度学习的艺术》-采铜
  5. 解决打开浏览器报proxy服务器发生错误
  6. linux环境hexo和GithubPages搭建个人博客
  7. 宝塔同时安装苹果cms海洋cms_海洋cms新手入门安装配置教程
  8. (数字ic)CDC跨时钟域可能出现的问题及解决办法总结
  9. 怎样用投资的逻辑来填报志愿?
  10. 分布式专题(1)- 计算机网络