解决:使用ss-calendar组件(Dcloud插件)报错 “TypeError: date.split is not a function“

报错情况:

vendor.js? [sm]:6707 [Vue warn]: Error in created hook: "TypeError: date.split is not a function"

found in

---> at components/ss-calendar/ss-calendar.vue
       pages/myInterGral/myInterGral.vue(env: Windows,mp,1.05.2204250; lib: 2.26.0

TypeError: date.split is not a function
    at ss-calendar.js? [sm]:340
    at Array.forEach ()
    at _loop (ss-calendar.js? [sm]:338)
    at VueComponent.getCurrentMonthDays (ss-calendar.js? [sm]:351)
    at VueComponent.getDayList (ss-calendar.js? [sm]:277)
    at VueComponent.initDate (ss-calendar.js? [sm]:190)
    at VueComponent.created (ss-calendar.js? [sm]:186)
    at invokeWithErrorHandling (vendor.js? [sm]:7954)
    at callHook (vendor.js? [sm]:10246)
    at VueComponent.Vue._init (vendor.js? [sm]:11054)(env: Windows,mp,1.05.2204250; lib: 2.26.0)

报错截图:

解决:使用ss-calendar组件(Dcloud插件)报错 “TypeError: date.split is not a function“_第1张图片

解决办法:

其实这个报错不是我们引入错误也不是我们代码书写错误,而是组件内部本身有错误

 找到该组件:

然后找到这个地方:

解决:使用ss-calendar组件(Dcloud插件)报错 “TypeError: date.split is not a function“_第2张图片 

这里的date其实是数组类型,我们只需要:

将date转为真正的字符串类型 

  checks.forEach(date => {
           date=typeof(date)
          const dateArr = date.split('-')

你可能感兴趣的:(前端bug,前端,uniapp,组件,Dcloud插件)