【发布时间】:2019-07-07 12:11:11
【问题描述】:
您好,我有一些来自 vuetify (https://vuetifyjs.com/en/components/cards#custom-actions) 的代码
所以我编辑了这样的代码:
<template>
<div>
<div v-for="item in 3" :key="item">
<v-layout row >
<v-flex xs12 sm6 offset-sm3>
<v-card>
<v-img
src="https://cdn.vuetifyjs.com/images/cards/sunshine.jpg"
height="200px"
>
</v-img>
<v-card-title primary-title>
<div>
<div class="headline">Top western road trips</div>
<span class="grey--text">1,000 miles of wonder</span>
</div>
</v-card-title>
<v-card-actions>
<v-btn flat>Share</v-btn>
<v-btn flat color="purple">Explore</v-btn>
<v-spacer></v-spacer>
<v-btn icon @click="show = !show">
<v-icon>{{ show ? 'keyboard_arrow_down' : 'keyboard_arrow_up' }}</v-icon>
</v-btn>
</v-card-actions>
<v-slide-y-transition>
<v-card-text v-show="show">
I'm a thing. But, like most politicians, he promised more than he could deliver. You won't have time for sleeping, soldier, not with all the bed making you'll be doing. Then we'll go with that data file! Hey, you add a one and two zeros to that or we walk! You're going to do his laundry? I've got to find a way to escape.
</v-card-text>
</v-slide-y-transition>
</v-card>
</v-flex>
</v-layout>
</div>
</div>
</template>
<script>
export default {
data: () => ({
show: false
})
}
</script>
问题在于 show 变量。 onClick 每个元素都会展开。
如何将每个元素设置为自己的变量?或者点击时只有这个元素会展开?
【问题讨论】:
标签: vue.js vuetify.js