【发布时间】: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