Object(...) is not a function,“export ‘default‘ (imported as ‘importEmployee‘) was not found in ‘@/

Object(...) is not a function,看到这个报错我可以百分百肯定的告诉你是你的函数有问题。浏览器找不到相对应的函数,快去看看你是不是在引入函数后使用的时候出错或者未定义这个函数吧!

import { tranListToTreeData } from '@/utils'
    

async getDepartments() {
      this.showTree = true
      //   this.loading = true
      const { depts } = await getDepartments()
      // depts是数组 但不是树形
      this.treeData = tranListToTreeData(depts, '')
      console.log(this.treeData)
    //   this.loading = false
    }

// 例如:这两个tranListToTreeData函数名称必须一样。

0:注册事件的时候结尾千万不要加s,

1:   key不需要引号

如图:


Object.keys(directives).forEach(key => { // 注册自定义指令
  Vue.directive(key, directives[key]) 
})

Object.keys(filters).forEach(key => {
  // 注册过滤器
  Vue.filter(key, filters[key])
})
// directive 和 filter千万不要加s
// key不需要''

"export 'default' (imported as 'importEmployee') was not found in '@/api/employees'

看到上面这个报错快去看看你的导入是否符合规范吧,按需导入是需要加{}的哦

"export 'default' (imported as 'XLSX') was not found in 'xlsx'  提示你没有导入文件 XLSX

最后就是如果有小伙伴在使用 import * as xxx from '@/xxxx' 这个语法后,想去 main.js 中循环遍历匹配每一项后通过 Object.keys 这个方法来注册一些事件的时候。一定要记得这以下两个坑!!!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值