defineProps 关于道具类型的解析错误:意外的令牌。您指的是 `{'}'}` 还是 `}`?
defineProps Parsing error regarding prop type: Unexpected token. Did you mean `{'}'}` or `}`?
const props = defineProps({
selectedData: <Record<string, string>>
});
右括号下有一条红线,表示
Parsing error: Unexpected token. Did you mean {'}'}
or
}
?eslint Expression expected.ts(1109)
我是不是类型定义有误?我不知道该怎么做。
我想遵循 vue.js 给出的这个例子:https://vuejs.org/guide/typescript/composition-api.html#typing-component-props
它用泛型完成了
const { selectedData } = defineProps<{ selectedData: <Record<string, string>> }>()
它实际上在vue的文档中,只需向下滚动:
If you are using TypeScript, it is also possible to declare props and emits using pure type annotations.
这意味着您可以使用:
const props = defineProps<{
selectedData: Record<string, string>;
}>();
const props = defineProps({
selectedData: <Record<string, string>>
});
右括号下有一条红线,表示
Parsing error: Unexpected token. Did you mean
{'}'}
or}
?eslint Expression expected.ts(1109)
我是不是类型定义有误?我不知道该怎么做。 我想遵循 vue.js 给出的这个例子:https://vuejs.org/guide/typescript/composition-api.html#typing-component-props
它用泛型完成了
const { selectedData } = defineProps<{ selectedData: <Record<string, string>> }>()
它实际上在vue的文档中,只需向下滚动:
If you are using TypeScript, it is also possible to declare props and emits using pure type annotations.
这意味着您可以使用:
const props = defineProps<{
selectedData: Record<string, string>;
}>();