Node.js SyntaxError,const数组函数
对不起,我对nodejs不是很有经验 我看到下面的错误 意外令牌(166:13) 我已经编写了一个单独的js文件i18.js:Node.js SyntaxError,const数组函数,node.js,Node.js,对不起,我对nodejs不是很有经验 我看到下面的错误 意外令牌(166:13) 我已经编写了一个单独的js文件i18.js: let lang_list = {} lang_list['en'] = {'Insert Table...': 'Insert Table...', 'Fill Color...': 'Fill Color...',} lang_list['zh'] = {'Insert Table...': 'Insert Table...',
let lang_list = {}
lang_list['en'] = {'Insert Table...': 'Insert Table...',
'Fill Color...': 'Fill Color...',}
lang_list['zh'] = {'Insert Table...': 'Insert Table...',
'Fill Color...': 'Fill Color...',
'Border Color....': 'Border Color....'}
export default function Lang(text) {
if (text in lang_list['zh']) {
return lang_list['zh'][text]
}
return text
}
我想在这里加载这个文件EditorToolbarConfig.js:
import Lang from './i18n';
export const COMMAND_GROUPS = [
{
Lang( 'Insert image by URL'): FontTypeCommandMenuButton,
},
{
Lang( '[format_size] Text Size'): FontSizeCommandMenuButton,
}]
出于某种原因,我看到了上面的错误
谢谢 动态关键点应使用括号
export const COMMAND_GROUPS = [
{
[Lang("Insert image by URL")]: FontTypeCommandMenuButton,
},
{
[Lang("[format_size] Text Size")]: FontSizeCommandMenuButton,
},
];
非常感谢你!这个简单的语法错误让我发疯。。。
import Lang from './i18n';
export const COMMAND_GROUPS = [
{
Lang( 'Insert image by URL'): FontTypeCommandMenuButton,
},
{
Lang( '[format_size] Text Size'): FontSizeCommandMenuButton,
}]
export const COMMAND_GROUPS = [
{
[Lang("Insert image by URL")]: FontTypeCommandMenuButton,
},
{
[Lang("[format_size] Text Size")]: FontSizeCommandMenuButton,
},
];