<template> <div class="folding"> <div v-for="(item,index) in message" :key="index" class="change"> <span @click="Click(index)">{ {item.title}}</span> <transition name="fade"> <p v-show="item.showContent">{ {item.content}}</p> </transition> </div> </div> </template> <script> export default { name: 'folding', data () { return { message: [ {'title': '标题1', content: '我是内容1', 'showContent': false}, {'title': '标题2', content: '我是内容2', 'showContent': false}, {'title': '标题3', content: '我是内容3', 'showContent': false} ], n: 0, } }, methods: { Click: function (index) { let temp = this.message temp[index].showContent = !temp[index].showContent } } } </script> <style scoped> *{ padding: 0; margin: 0; } .folding{ width: 400px; height: 800px; borde