更新组件演示页面,方便用户直接使用组件,去除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,38 +1,68 @@
<template>
<view class="components-progress">
<view class="components-progress tn-safe-area-inset-bottom">
<!-- 顶部自定义导航 -->
<tn-nav-bar fixed>Progress进度条</tn-nav-bar>
<!-- 页面内容 -->
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<dynamic-demo-template ref="demoTemplate" :tips="tips" :sectionList="sectionList" :full="true" @click="click">
<block v-if="customPercent">
<tn-line-progress v-if="mode === 'line'" :percent="percent" :height="height" :activeColor="activeColor"
:striped="striped" :stripedAnimation="stripedAnimation" :showPercent="showPercent">
<block v-if="customPercent">
<view class="tn-color-white">加载中</view>
</block>
<demo-title title="基本进度条">
<tn-line-progress :percent="30"></tn-line-progress>
<view class="tn-margin-top">
<tn-line-progress :percent="50"></tn-line-progress>
</view>
<view class="tn-margin-top">
<tn-line-progress :percent="80"></tn-line-progress>
</view>
<view class="tn-flex tn-flex-col-center tn-flex-row-left tn-flex-wrap tn-margin-top">
<view>
<tn-circle-progress :percent="30"></tn-circle-progress>
</view>
<view class="tn-margin-left">
<tn-circle-progress :percent="50"></tn-circle-progress>
</view>
<view class="tn-margin-left">
<tn-circle-progress :percent="80"></tn-circle-progress>
</view>
</view>
</demo-title>
<demo-title title="修改进度条颜色">
<tn-line-progress :percent="50" activeColor="#2DE88D"></tn-line-progress>
<view class="tn-margin-top">
<tn-line-progress :percent="50" activeColor="#31E749" inactiveColor="#FAD8D6"></tn-line-progress>
</view>
</demo-title>
<demo-title title="显示条纹">
<tn-line-progress :percent="50" :striped="true"></tn-line-progress>
<view class="tn-margin-top">
<tn-line-progress :percent="50" :striped="true" :stripedAnimation="false"></tn-line-progress>
</view>
</demo-title>
<demo-title title="显示进度信息">
<tn-line-progress :percent="50" :showPercent="true"></tn-line-progress>
<view class="tn-margin-top">
<tn-line-progress :percent="50">
<view class="tn-color-white">加载中</view>
</tn-line-progress>
<view class="tn-flex tn-flex-row-center">
<tn-circle-progress v-if="mode === 'circle'" :percent="percent" :showPercent="showPercent">
<block v-if="customPercent">
<view class="tn-color-red">加载中</view>
</block>
</view>
<view class="tn-flex tn-flex-col-center tn-flex-row-left tn-flex-wrap tn-margin-top">
<view>
<tn-circle-progress :percent="50" :showPercent="true"></tn-circle-progress>
</view>
<view class="tn-margin-left">
<tn-circle-progress :percent="50">
<view class="tn-color-red">加载中</view>
</tn-circle-progress>
</view>
</block>
<block v-else>
<tn-line-progress v-if="mode === 'line'" :percent="percent" :height="height" :activeColor="activeColor"
:striped="striped" :stripedAnimation="stripedAnimation" :showPercent="showPercent"></tn-line-progress>
<view class="tn-flex tn-flex-row-center">
<tn-circle-progress v-if="mode === 'circle'" :percent="percent" :showPercent="showPercent">
</tn-circle-progress>
</view>
</block>
</dynamic-demo-template>
</view>
</demo-title>
<view class="tn-padding-bottom-lg"></view>
</view>
@@ -41,163 +71,26 @@
</template>
<script>
import dynamicDemoTemplate from '@/libs/components/dynamic-demo-template.vue'
import demoTitle from '@/libs/components/demo-title.vue'
export default {
name: 'componentsStriped',
components: {
dynamicDemoTemplate
},
name: 'componentsProgress',
components: {demoTitle},
data() {
return {
mode: 'line',
percent: 50,
height: 28,
activeColor: '#01BEFF',
showPercent: false,
striped: false,
stripedAnimation: true,
customPercent: false,
tips: ['无需依赖额外的样式文件', '使用tn-line-progress、tn-circle-progress组件'],
sectionList: [
{
name: '参数切换',
section: [
{
title: '模式',
optional: ['线条','圆环'],
methods: 'modeChange'
},
{
title: '进度',
optional: ['减少10%','增加10%'],
methods: 'percentChange'
},
{
title: '高度',
optional: ['18','28','38'],
methods: 'heightChange',
current: 1
},
{
title: '激活时颜色',
optional: ['#01BEFF','#2DE88D'],
methods: 'activeColorChange'
},
{
title: '显示条纹',
optional: ['是','否'],
methods: 'stripedChange',
current: 1
},
{
title: '动态条纹',
optional: ['是','否'],
methods: 'stripedAnimationChange',
show: false
},
{
title: '显示进度信息',
optional: ['是','否'],
methods: 'showPercentChange',
current: 1
},
{
title: '自定义进度信息',
optional: ['是','否'],
methods: 'customPercentChange',
current: 1
}
]
}
]
}
},
methods: {
click(event) {
this[event.methods] && this[event.methods](event)
},
// 切换模式
modeChange(event) {
switch (event.index) {
case 0:
this.mode = 'line'
if (this.striped) {
this.$refs.demoTemplate.updateSectionBtnsState([2,3,4,5], true)
} else {
this.$refs.demoTemplate.updateSectionBtnsState([2,3,4], true)
}
break
case 1:
this.mode = 'circle'
this.$refs.demoTemplate.updateSectionBtnsState([2,3,4,5], false)
break
}
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换进度
percentChange(event) {
let percent = 0
switch (event.index) {
case 0:
percent = this.percent - 10
this.percent = percent > 0 ? percent : 0
break
case 1:
percent = this.percent + 10
this.percent = percent > 100 ? 100 : percent
break
}
},
// 切换高度
heightChange(event) {
this.height = Number(event.name)
this.$refs.demoTemplate.updateSectionScrollView()
},
// 切换激活时颜色
activeColorChange(event) {
this.activeColor = event.name
},
// 切换进度信息显示
showPercentChange(event) {
if (event.index === 0) {
this.showPercent = true
this.customPercent = false
this.$refs.demoTemplate.updateSectionBtnsState(7, false)
} else {
this.showPercent = false
this.$refs.demoTemplate.updateSectionBtnsState(7, true)
}
},
// 切换条纹
stripedChange(event) {
if (event.index === 0) {
this.striped = true
this.$refs.demoTemplate.updateSectionBtnsState(5, true)
} else {
this.striped = false
this.$refs.demoTemplate.updateSectionBtnsState(5, false)
}
},
// 切换条纹动画
stripedAnimationChange(event) {
this.stripedAnimation = event.index === 0 ? true : false
},
// 切换自定义进度信息
customPercentChange(event) {
this.customPercent = event.index === 0 ? true : false
}
},
}
}
</script>
<style lang="scss" scoped>
.components-progress {
min-height: 100vh;
}
tn-line-progress, .tn-line-progress {
width: 100%;
}