【发布时间】:2022-01-24 23:17:48
【问题描述】:
更新...
我正在尝试在我的 nuxt.config.js 中使用导入的对象 这是 Nuxt.js 配置文件。
我有这个: seo.js
export default {
link: [
{
rel: 'icon',
type: 'image/x-icon',
href: '/img/favicon.ico',
},
],
meta: [
{
charset: 'utf-8'
}
]
}
然后在nuxt.config.js中:
import seo from './seo'
export default {
head() {
return {
...seo,
}
},
... other config setting ...
}
然后我收到一个错误:“_seo 未定义” 我不是想将 head 作为函数导出,这是配置文件,还有更多设置。
虽然这可行,但 nuxt.config.js:
import seo from './seo'
export default {
head: {
...seo,
}
}
... other config settings ...
}
我无法在函数中使用导入的对象。我很困惑,这里有什么问题,我该如何使用那个导入的对象?
【问题讨论】:
标签: javascript nuxt.js es6-modules