【发布时间】:2020-10-15 17:58:08
【问题描述】:
我想在单击按钮时更改图像。
我做了这个:
home.html
还有我的家.ts
export class HomePage implements OnInit {
cards;
constructor() {
this.cards = [];
}
ngOnInit() {}
logEvent(event) {
console.log("click");
this.cards = [
{
img: "https://placeimg.com/300/300/people",
},
{
img: "https://placeimg.com/300/300/animals",
},
];
}
}
但这是我能做到的。
【问题讨论】:
-
你的卡片变量是一个数组,你打算显示多张图片还是只显示一张?
标签: html typescript image ionic-framework ionic4