gpt4 book ai didi

javascript - 单击时如何记录国家/地区名称?

转载 作者:行者123 更新时间:2023-12-04 08:14:58 25 4
gpt4 key购买 nike

我正在使用 VueJS,REST API , axios 获取国家列表并将它们显示在页面上的卡片中。我需要制作最近点击的 5 个国家/地区的历史列表,但我不确定如何处理。
记录页面上的所有国家/地区有效,但我需要记录单击的特定国家/地区。
Here's the code for the component

<strong class="card-text" v-on:click="handleClick">{{
country.name
}}</strong>
        handleClick() {
//console.log("[response]", JSON.stringify(this.countries));
},

最佳答案

你的意思是想知道如何将点击的国家的信息传递给handleClick ?
也许像这样的东西?

<strong class="card-text" v-on:click="handleClick(country)">
{{ country.name }}
</strong>

handleClick(country) {
console.log("Clicked on: " + country.name);
},

关于javascript - 单击时如何记录国家/地区名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65749394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com