<div class="cart" v-show="cart"> <div class="cart-content"> <img :src="imgUrl" /> </div> </div>
// display contents and switching cards
showCart (I) {
// not solve the problem
//this.imgUrl = ''; the this .imgUrl = the this .url [I]; the this .cart = to true ; },
// hide card closeCard () { the this .cart = to false ; },
These are the problems in your code
1. Use the v-if, without v-show, brings frequent switching consumption
2. After you hide empty card imgUrl
closeCard(){ this.card = false; this.imgUrl = ''; }
3. Use multiple cards (recommended)