list组件怎么不能用?
已解决
"ui";
ui.layout(
<list id="list">
<horizontal>
<text id="name" textSize="16sp" textColor="#000000" text="姓名: {{name}}"/>
<text id="age" textSize="16sp" textColor="#000000" text="年龄:{{age}}岁"/>
<button id="deleteItem" text="删除"/>
</horizontal>
</list>
);
var items = [
{name: "小明", age: 18}, {name: "小红", age: 30},
{name: "小东", age: 19}, {name: "小强", age: 31},
{name: "小满", age: 20}, {name: "小一", age: 32},
];
ui.list.setDataSource(items);
之前的问题是 "name" is not defined.
应该把{{name}}
{{age}}
修改为 {{this.name}}
{{this.age}}