【问题标题】:getting TypeError: o is not a function on a laravel and vue 2.6.14 project获取类型错误:o 不是 laravel 和 vue 2.6.14 项目上的函数
【发布时间】:2023-02-14 20:22:22
【问题描述】:

我得到 typeError: o is not a function 当我运行 npm run prod 但是当我运行 npm run dev 我不明白

它发生在实时服务器和开发中

我的代码

export default {
  name: "CreateTimesheet",
  props: ["employees", "creatorId"],
  mounted() {
    this.employee_id = this.creatorId;
    this.getProjects();
  },
  data: () => {
    return {
      employee_id: 1,
      project_id: 0,
      projects_dropdown: [],
    }
  },
  methods: {
    async getProjects() {
      try {
        const res = await fetch('/getclientprojects/'+this.employee_id).then(response => response.json());
        this.projects_dropdown.push(...res.projects)
        this.project_id = res.active_projects // It happens when i add this line
      }catch (e) {
        console.log(e)
      }
    }
  }
}
</script>```

【问题讨论】:

  • 错误在你的 app.js 文件的第 1 行,也许你在那里有错误。发布您问题中的内容
  • @audiojames 它在错误中提到的 app.js 是已缩小的已编译 1 你是说那个 1 的内容吗
  • 在你的 vue 组件中似乎没有任何东西会导致这个错误,所以错误可能在另一个文件或包中。
  • 我也怀疑它是另一个包裹,如果是这样,我只需要弄清楚它是哪个包裹

标签: vue.js


【解决方案1】:

请问您找到任何解决方案了吗?

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2021-11-15
  • 2022-08-15
  • 1970-01-01
  • 2019-05-17
  • 1970-01-01
  • 1970-01-01
  • 2018-08-06
  • 2022-09-24
相关资源
最近更新 更多