四时宝库

程序员的知识宝库

uniapp Vant组件库的Grid宫格报错问题处理《uniapp开发系列 三 》

在前两期分享中,我们已经讲过如何在uniapp中引用vant。在引用vant后,在使用Grid宫格组件时,会发现不兼容及console报错的情况。如图:

问题是说编译之后的vant组件库中的/wxcomponents/vant/grid-item/index.js文件渲染找不到indexOf()方法

Error in mounted hook: "TypeError: Cannot read properties of undefined (reading 'indexOf')"

以下是我的解决方案。简单粗暴.直接把index.js中43行删除或者注释即可。如果大家的更好的意见可以分享一下。

index: children.indexOf(this),  //删除或者注释该行

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言
    友情链接