<template>
<div class="content-container">
<!-- 展开按钮 -->
<button @click="toggleContent(true)">展开</button>
<!-- 收起按钮 -->
<button @click="toggleContent(false)">收起</button>
<!-- 根据isContentVisible的状态来决定是否渲染内容 -->
<div v-if="isContentVisible">
<p>这里是可以展开和收起的内容。</p>
<!-- 这里可以是任何你希望控制显示隐藏的内容 -->
</div>
</div>
</template>
<script>
export default {
data() {
return {
isContentVisible: false, // 控制内容显示的数据属性
};
},
methods: {
// 切换内容的显示状态
toggleContent(show) {
this.isContentVisible = show;
}
}
};
</script>
<style scoped>
.content-container {
/* 你的样式 */
}
</style>
01-25
1300
04-13
857
01-08
2833
02-24
3913
06-30
2835