2021-02-05 17:26:08 +08:00

217 lines
5.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<text class="example-info">折叠面板用来折叠/显示过长的内容或者是列表通常是在多内容分类项使用折叠不重要的内容显示重要内容点击可以展开折叠部分</text>
<view v-for="(item, index) in list" :key="index">
<uni-section :title="item.name" type="line"></uni-section>
<uni-collapse ref="add" class="warp" @change="change">
<uni-collapse-item v-for="(sub, key) in item.data" :key="key" :open="sub.open" :show-animation="sub.showAnimation" :disabled="sub.disabled" :title="sub.subName">
<text class="content">{{ sub.content }}</text>
</uni-collapse-item>
</uni-collapse>
</view>
<uni-section title="手风琴效果" type="line"></uni-section>
<uni-collapse :accordion="true">
<uni-collapse-item v-for="item in accordion" :key="item.id" :title="item.title" :show-animation="item.animation">
<text class="content">{{ item.content }}</text>
</uni-collapse-item>
</uni-collapse>
<uni-section title="配置图标" type="line"></uni-section>
<uni-collapse>
<uni-collapse-item title="标题文字" thumb="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png">
<text class="content">折叠内容主体可自定义内容及样式</text>
</uni-collapse-item>
<uni-collapse-item title="标题文字" thumb="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png">
<text class="content">折叠内容主体可自定义内容及样式</text>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
export default {
components: {},
data() {
const listData = [{
name: '基础用法',
data: [{
type: false,
subName: '默认开启',
open: true,
content: '折叠内容主体,可自定义内容及样式'
},
{
type: false,
subName: '折叠内容',
content: '折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段问题。再次点击标题,折叠内容。'
},
{
type: false,
subName: '禁用状态',
disabled: true,
content: '折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段问题。再次点击标题,折叠内容。'
}
]
},
{
name: '添加动画效果',
data: [{
type: true,
subName: '动画效果',
showAnimation: true,
content: '折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段问题。再次点击标题,折叠内容。'
}]
}
]
return {
list: listData,
accordion: [{
id: 0,
title: '标题文字',
content: '手风琴效果',
animation: true
},
{
id: 1,
title: '标题文字',
content: '手风琴效果',
animation: true
},
{
id: 2,
title: '标题文字',
content: '手风琴效果',
animation: true
}
],
extraIcon: {
color: '#4cd964',
size: '26',
type: 'image'
},
id: 2
}
},
methods: {
change(e) {}
}
}
</script>
<style>
@charset "UTF-8";
/* 头条小程序组件内不能引入字体 */
/* #ifdef MP-TOUTIAO */
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url("~@/static/uni.ttf") format("truetype");
}
/* #endif */
/* #ifndef APP-NVUE */
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #efeff4;
min-height: 100%;
height: auto;
}
view {
font-size: 14px;
line-height: inherit;
}
.example {
padding: 0 15px 15px;
}
.example-info {
padding: 15px;
color: #3b4144;
background: #ffffff;
}
.example-body {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 0;
font-size: 14px;
background-color: #ffffff;
}
/* #endif */
.example {
padding: 0 15px;
}
.example-info {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
padding: 15px;
color: #3b4144;
background-color: #ffffff;
font-size: 14px;
line-height: 20px;
}
.example-info-text {
font-size: 14px;
line-height: 20px;
color: #3b4144;
}
.example-body {
flex-direction: column;
padding: 15px;
background-color: #ffffff;
}
.word-btn-white {
font-size: 18px;
color: #FFFFFF;
}
.word-btn {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
border-radius: 6px;
height: 48px;
margin: 15px;
background-color: #007AFF;
}
.word-btn--hover {
background-color: #4ca2ff;
}
.example-body {
flex-direction: column;
flex: 1;
}
.content {
padding: 15px;
font-size: 14px;
line-height: 20px;
background-color: #f9f9f9;
color: #666;
}
.button {
font-size: 26rpx;
line-height: 90rpx;
}
</style>