更新组件演示页面,方便用户直接使用组件,去除tn-button的默认背景色,tn-avatar修改参数默认值,修复tn-avatar-group最开始头像进行了偏移、修复无法使用标签的bug,tn-badge修改参数默认值,tn-collapse-item修复背景颜色失效问题,滚动通知移除默认背景颜色和字体大小,tn-count-down修复时间单位不正确问题,列表组件修复背景颜色问题,tn-nav-bar返回按钮修改为可进行修改的图标,tn-step添加点击步骤进行跳转,tn-loading修复默认激活颜色出错问题,tn-tag移除默认背景颜色,优化阴影大小css

This commit is contained in:
JaylenTech
2022-02-08 19:55:15 +08:00
parent 043ee3f585
commit 946bb52c03
94 changed files with 6296 additions and 4727 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="components-list">
<view class="components-list tn-safe-area-inset-bottom">
<!-- 顶部自定义导航 -->
<tn-nav-bar fixed>列表</tn-nav-bar>
@@ -8,37 +8,197 @@
<!-- 页面内容 -->
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<dynamic-demo-template ref="demoTemplate" :tips="tips" :sectionList="sectionList" :full="true" @click="click">
<tn-list-view
:backgroundColor="viewBackgroundColor"
:fontColor="viewFontColor"
:fontSize="viewFontSize"
:title="viewTitle"
:unlined="viewUnlined"
:card="viewCard"
:marginTop="viewMarginTop"
>
<block v-if="viewCustomTitle">
<view slot="title" class="list-title-container">
<tn-button class="list-title-button">设置</tn-button>
<demo-title title="基础">
<view>
<tn-list-view
unlined="bottom"
:customTitle="true"
>
<template slot="title">
<view class="custom-title">
<tn-button shape="" backgroundColor="tn-main-gradient-indigo" @click="openOptions">设置</tn-button>
</view>
</template>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单一</tn-list-cell>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单二</tn-list-cell>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单三</tn-list-cell>
</tn-list-view>
</view>
<view class="tn-margin-top">
<tn-list-view
:card="true"
title="卡片式列表"
backgroundColor="#EFEFEF"
>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单一</tn-list-cell>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单二</tn-list-cell>
<tn-list-cell :arrow="cellArrow" :arrowRight="cellArrowRight" :unlined="cellUnlined" :lineLeft="cellLineLeft" :lineRight="cellLineRight">菜单三</tn-list-cell>
</tn-list-view>
</view>
</demo-title>
<demo-title title="列表项单独使用">
<view>
<tn-list-cell>
普通列表
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell :radius="true">
圆角列表
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-icon-text">
<view class="list__left">
<view class="list__left__icon tn-icon-discover tn-color-gray"></view>
<view class="list__left__text">图标 + 文字</view>
</view>
</view>
</block>
<block v-for="(item, index) in 3" :key="index">
<tn-list-cell
:backgroundColor="cellBackgroundColor"
:fontColor="cellFontColor"
:fontSize="cellFontSize"
:arrow="cellArrow"
:arrowRight="cellArrowRight"
:hover="cellHover"
:radius="cellRadius"
:unlined="cellUnlined"
:lineLeft="cellLineLeft"
:lineRight="cellLineRight"
>选项 {{ index }}</tn-list-cell>
</block>
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-image-text">
<view class="list__left">
<image src="/static/favicon.ico" class="list__left__image"></image>
<view class="list__left__text">图片 + 文字</view>
</view>
</view>
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-icon-text">
<view class="list__left">
<view class="list__left__icon tn-icon-order tn-color-indigo"></view>
<view class="list__left__text">文本</view>
</view>
<view class="list__right">
<view class="tn-text-sm tn-color-gray">定一个小目标吧</view>
</view>
</view>
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-icon-text">
<view class="list__left">
<view class="list__left__icon tn-icon-upload tn-color-cyan"></view>
<view class="list__left__text">按钮</view>
</view>
<view class="list__right">
<tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" shape="round" size="sm">
<text class="tn-icon-upload tn-margin-right-xs"></text>上传
</tn-button>
</view>
</view>
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-icon-text">
<view class="list__left">
<view class="list__left__icon tn-icon-tag tn-text-clip tn-main-gradient-orangeyellow"></view>
<view class="list__left__text">标签</view>
</view>
<view class="list__right">
<tn-tag backgroundColor="tn-main-gradient-indigo" shape="circle" margin="0rpx 5rpx">篮球</tn-tag>
<tn-tag backgroundColor="tn-main-gradient-indigo" shape="circle" margin="0rpx 5rpx">足球</tn-tag>
<tn-tag backgroundColor="tn-main-gradient-indigo" shape="circle" margin="0rpx 5rpx">小球</tn-tag>
</view>
</view>
</tn-list-cell>
</view>
<view class="tn-margin-top-sm">
<tn-list-cell>
<view class="list-icon-text">
<view class="list__left">
<view class="list__left__icon tn-icon-emoji-good tn-text-clip tn-main-gradient-orangered"></view>
<view class="list__left__text">头像组</view>
</view>
<view class="list__right">
<tn-avatar-group :lists="avatarGroupList" size="sm"></tn-avatar-group>
</view>
</view>
</tn-list-cell>
</view>
</demo-title>
<demo-title title="聊天示例">
<tn-list-view title="消息列表" unlined="bottom">
<tn-list-cell :unlined="true">
<view class="message">
<view class="message__left">
<tn-avatar src="https://tnuiimage.tnkjapp.com/avatar/xiaomai1.jpg"></tn-avatar>
</view>
<view class="message__middle">
<view class="message__name">小图鸟</view>
<view class="message__content tn-text-ellipsis">欢迎使用图鸟UI图鸟UI专做UI界面100年</view>
</view>
<view class="message__right">
<view class="message__time">13:14</view>
<view class="message__tips">
<tn-tag backgroundColor="tn-bg-red" fontColor="tn-color-white" shape="circle" width="auto" size="sm">99</tn-tag>
</view>
</view>
</view>
</tn-list-cell>
<tn-list-cell :unlined="true">
<view class="message">
<view class="message__left">
<tn-avatar src="https://tnuiimage.tnkjapp.com/avatar/xiaomai1.jpg" :badge="true" badgeText="99" badgeBgColor="tn-bg-red" badgeColor="tn-color-white"></tn-avatar>
</view>
<view class="message__middle">
<view class="message__name">小图鸟</view>
<view class="message__content tn-text-ellipsis">欢迎使用图鸟UI图鸟UI专做UI界面100年</view>
</view>
<view class="message__right">
<view class="message__time">13:14</view>
<view class="message__tips">
<text class="message__tips__icon tn-icon-sound-close"></text>
</view>
</view>
</view>
</tn-list-cell>
</tn-list-view>
</dynamic-demo-template>
</demo-title>
<view class="tn-padding-bottom-lg"></view>
<tn-modal
v-model="showListOptions"
:custom="true"
padding="0"
>
<tn-list-view>
<tn-list-cell>
<view class="list__options">
<view class="list__options__title">下划线</view>
<view class="list__options__switch"><tn-switch v-model="cellShowBorderLine" leftIcon="close" rightIcon="success" @change="closeOptions"></tn-switch></view>
</view>
</tn-list-cell>
<tn-list-cell v-if="!cellUnlined">
<view class="list__options">
<view class="list__options__title">长下划线</view>
<view class="list__options__switch"><tn-switch v-model="cellLongBorderLine" leftIcon="close" rightIcon="success" @change="closeOptions"></tn-switch></view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="list__options">
<view class="list__options__title">箭头</view>
<view class="list__options__switch"><tn-switch v-model="cellArrow" leftIcon="close" rightIcon="success" @change="closeOptions"></tn-switch></view>
</view>
</tn-list-cell>
<tn-list-cell v-if="cellArrow">
<view class="list__options">
<view class="list__options__title">无边距箭头</view>
<view class="list__options__switch"><tn-switch v-model="cellNoPaddingArrow" leftIcon="close" rightIcon="success" @change="closeOptions"></tn-switch></view>
</view>
</tn-list-cell>
</tn-list-view>
</tn-modal>
</view>
@@ -47,260 +207,159 @@
</template>
<script>
import dynamicDemoTemplate from '@/libs/components/dynamic-demo-template.vue'
import demoTitle from '@/libs/components/demo-title.vue'
export default {
name: 'componentsList',
components: {dynamicDemoTemplate},
components: {demoTitle},
data() {
return {
viewBackgroundColor: '',
viewFontColor: '',
viewFontSize: 0,
viewTitle: '',
viewCustomTitle: false,
viewCard: false,
viewMarginTop: '',
viewUnlined: 'all',
showListOptions: false,
cellShowBorderLine: true,
cellLongBorderLine: false,
cellNoPaddingArrow: false,
cellBackgroundColor: '',
cellFontColor: '',
cellFontSize: 0,
cellArrow: true,
cellArrow: false,
cellArrowRight: true,
cellRadius: false,
cellUnlined: false,
cellLineLeft: true,
cellLineRight: true,
cellHover: false,
tips: ['无需依赖额外的样式文件','使用tn-list-view、tn-list-cell组件'],
sectionList: [
{
name: '容器参数',
section: [
{
title: '自定义颜色',
optional: ['默认','自定义'],
methods: 'viewColorChange'
},
{
title: '自定义大小',
optional: ['默认','自定义'],
methods: 'viewSizeChange'
},
{
title: '标题类型',
optional: ['空白','文字标题','自定义标题'],
methods: 'viewTitleChange'
},
{
title: '容器类型',
optional: ['默认','卡片'],
methods: 'viewContainerChange'
},
{
title: '边框类型',
optional: ['全部显示','上边框','下边框','不显示'],
methods: 'viewBoardChange',
current: 3
}
]
},
{
name: '列表参数',
section: [
{
title: '自定义颜色',
optional: ['默认','自定义'],
methods: 'cellColorChange'
},
{
title: '自定义大小',
optional: ['默认','自定义'],
methods: 'cellSizeChange'
},
{
title: '显示类型',
optional: ['默认','圆角'],
methods: 'cellRadiusChange'
},
{
title: '箭头',
optional: ['隐藏','显示'],
methods: 'cellArrowChange',
current: 1
},
{
title: '箭头边距',
optional: ['默认','无边距'],
methods: 'cellArrowRightChange'
},
{
title: '显示底边',
optional: ['显示','隐藏'],
methods: 'cellUnlinedChange',
},
{
title: '底边边距',
optional: ['默认','无边距'],
methods: 'cellLineChange',
},
{
title: '点击效果',
optional: ['无','有'],
methods: 'cellHoverChange',
}
]
}
avatarGroupList: [
{src: 'https://tnuiimage.tnkjapp.com/avatar/xiaomai1.jpg'},
{src: 'https://tnuiimage.tnkjapp.com/avatar/xiaomai2.jpg'},
{src: 'https://tnuiimage.tnkjapp.com/avatar/xiaomai1.jpg'},
{src: 'https://tnuiimage.tnkjapp.com/avatar/xiaomai2.jpg'},
]
}
},
methods: {
click(event) {
this[event.methods] && this[event.methods](event)
},
// 切换容器颜色
viewColorChange(event) {
if (event.index === 0) {
this.viewBackgroundColor = ''
this.viewFontColor = ''
} else {
this.viewBackgroundColor = '#F8F7F8'
this.viewFontColor = 'tn-color-grey'
}
},
// 切换容器大小
viewSizeChange(event) {
if (event.index === 0) {
this.viewFontSize = 0
this.viewMarginTop = ''
} else {
this.viewFontSize = 32
this.viewMarginTop = '48rpx'
}
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换容器标题
viewTitleChange(event) {
switch(event.index) {
case 0:
this.viewTitle = ''
this.viewCustomTitle = false
break
case 1:
this.viewTitle = '请选择对应的选项'
this.viewCustomTitle = false
break
case 2:
this.viewTitle = ''
this.viewCustomTitle = true
break
}
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换容器类型
viewContainerChange(event) {
this.viewCard = event.index === 0 ? false : true
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换容器边框类型
viewBoardChange(event) {
switch(event.index) {
case 0:
this.viewUnlined = ''
break
case 1:
this.viewUnlined = 'bottom'
break
case 2:
this.viewUnlined = 'top'
break
case 3:
this.viewUnlined = 'all'
break
}
},
// 切换列表颜色
cellColorChange(event) {
if (event.index === 0) {
this.cellBackgroundColor = ''
this.cellFontColor = ''
} else {
this.cellBackgroundColor = '#D6F4FA'
this.cellFontColor = 'tn-color-grey'
}
},
// 切换列表大小
cellSizeChange(event) {
if (event.index === 0) {
this.cellFontSize = 0
} else {
this.cellFontSize = 36
}
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换列表圆角
cellRadiusChange(event) {
this.cellRadius = event.index === 0 ? false : true
},
// 切换列表箭头显示
cellArrowChange(event) {
if (event.index === 0) {
this.cellArrow = false
this.$refs.demoTemplate.updateSectionBtnsState(4, false)
} else {
this.cellArrow = true
this.$refs.demoTemplate.updateSectionBtnsState(4, true)
}
},
// 切换列表箭头贴边
cellArrowRightChange(event) {
this.cellArrowRight = event.index === 0 ? true : false
},
// 切换列表底边显示
cellUnlinedChange(event) {
if (event.index === 0) {
watch: {
cellShowBorderLine(val) {
if (val) {
this.cellUnlined = false
this.$refs.demoTemplate.updateSectionBtnsState(6, true)
} else {
this.cellUnlined = true
this.$refs.demoTemplate.updateSectionBtnsState(6, false)
}
},
// 切换列表底边的边距
cellLineChange(event) {
if (event.index === 0) {
this.cellLineLeft = true
this.cellLineRight = true
} else if (event.index === 1) {
cellLongBorderLine(val) {
if (val) {
this.cellLineLeft = false
this.cellLineRight = false
} else {
this.cellLineLeft = true
this.cellLineRight = true
}
},
// 切换列表点击效果
cellHoverChange(event) {
this.cellHover = event.index === 0 ? false : true
},
cellNoPaddingArrow(val) {
if (val) {
this.cellArrowRight = false
} else {
this.cellArrowRight = true
}
}
},
methods: {
// 弹出设置弹框
openOptions() {
this.showListOptions = true
},
// 关闭设置弹框
closeOptions() {
this.showListOptions = false
}
}
}
</script>
<style lang="scss" scoped>
.list-title-container {
.components-list {
background-color: $tn-bg-gray-color;
min-height: 100vh;
}
.custom-title {
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding: 10rpx;
padding: 10rpx 20rpx;
}
.list__options {
display: flex;
align-items: center;
justify-content: space-between;
}
.list {
&__left {
display: flex;
align-items: center;
justify-content: flex-start;
&__icon, &__image {
margin-right: 18rpx;
}
}
.list-title-button {
width: 160rpx !important;
height: 46rpx !important;
color: #FFFFFF;
margin: 10rpx !important;
&__right {
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.list-icon-text, .list-image-text {
display: flex;
align-items: center;
justify-content: space-between;
}
.list-image-text {
.list {
&__left {
&__image {
width: 20rpx;
height: 20rpx;
}
}
}
}
.message {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
&__left {
width: 10%;
}
&__middle {
width: 80%;
padding-left: 20rpx;
padding-right: 40rpx;
}
&__right {
width: 10%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
&__name {
font-size: 32rpx;
margin-bottom: 8rpx;
}
&__content {
font-size: 26rpx;
color: #838383;
}
&__tips {
&__icon {
font-size: 36rpx;
color: #AAAAAA;
}
}
}
</style>