未找到导出默认值 [英] Export default was not found
本文介绍了未找到导出默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Vue 2项目,我编写了一个简单的函数来翻译几个月的日期,我想在我的一个组件中导入,但是我收到一个错误:
I have a Vue 2 project, and I've written a simple function for translating months in dates, which I would like to import in one of my components, but I'm getting an error:
在'@ / utils / date-translation'中找不到导出'default'(导入为'translateDate')
export 'default' (imported as 'translateDate') was not found in '@/utils/date-translation'
来自src文件夹的相对文件路径是正确的,我正在导出这样的函数:
The relative file path from the src folder is correct, and I am exporting the function like this:
export function translateDate(date) {
// my code
}
然后我在这样的组件中导入它:
And then I am importing it in the component like this:
import translateDate from '@/utils/date-translation'
我做错了什么?
推荐答案
您必须明确指定默认
:
export default function translateDate(date) {
..
}
这篇关于未找到导出默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文