我有下面的表达:
public mySentences:Array<string> = [
{id: 1, text: 'Sentence 1'},
{id: 2, text: 'Sentence 2'},
{id: 3, text: 'Sentence 3'},
{id: 4, text: 'Sentenc4 '},
];
这不起作用,因为我的数组不是类型string
,而是包含一个对象列表.我如何处理数组以包含对象列表?
*没有一个新的组件来声明一个类的句子,这似乎是一种浪费