更新组件演示页面,方便用户直接使用组件,去除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-number_box">
<view class="components-number_box tn-safe-area-inset-bottom">
<!-- 顶部自定义导航 -->
<tn-nav-bar fixed>numberBox步进输入</tn-nav-bar>
@@ -8,22 +8,42 @@
<!-- 页面内容 -->
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<dynamic-demo-template ref="demoTemplate" :tips="tips" :sectionList="sectionList" :full="false" @click="click">
<tn-number-box
v-model="value"
:min="min"
:max="max"
:step="step"
:disabled="disabled"
:disabledInput="disabledInput"
:inputWidth="inputWidth"
:inputHeight="inputHeight"
:positiveInteger="positiveInteger"
:backgroundColor="backgroundColor"
:fontColor="fontColor"
:fontSize="fontSize"
></tn-number-box>
</dynamic-demo-template>
<demo-title title="基本使用">
<view class="tn-flex tn-flex-col-center tn-flex-row-left">
<view>
<tn-number-box v-model="value1"></tn-number-box>
</view>
<view class="tn-margin-left">
<tn-number-box v-model="value1" :disabled="true"></tn-number-box>
</view>
</view>
</demo-title>
<demo-title title="设置步进值">
<tn-number-box v-model="value2" :step="2"></tn-number-box>
</demo-title>
<demo-title title="设置最小最大值">
<tn-number-box v-model="value3" :min="50" :max="1000"></tn-number-box>
</demo-title>
<demo-title title="设置允许输入小数">
<tn-number-box v-model="value4" :positiveInteger="false" :step="0.5"></tn-number-box>
</demo-title>
<demo-title title="禁止输入">
<tn-number-box v-model="value5" :disabledInput="true"></tn-number-box>
</demo-title>
<demo-title title="自定义尺寸">
<tn-number-box v-model="value6" :inputWidth="140" :inputHeight="60" :fontSize="40"></tn-number-box>
</demo-title>
<demo-title title="自定义颜色">
<tn-number-box v-model="value7" backgroundColor="#AAAAAA" fontColor="#838383"></tn-number-box>
</demo-title>
<view class="tn-padding-bottom-lg"></view>
</view>
@@ -32,140 +52,29 @@
</template>
<script>
import dynamicDemoTemplate from '@/libs/components/dynamic-demo-template.vue'
import demoTitle from '@/libs/components/demo-title.vue'
export default {
name: 'componentsNumberBox',
components: {dynamicDemoTemplate},
components: {demoTitle},
data() {
return {
value: 0,
min: 0,
max: 100,
step: 1,
disabled: false,
disabledInput: false,
inputWidth: 88,
inputHeight: 50,
positiveInteger: true,
backgroundColor: '#E6E6E6',
fontColor: '',
fontSize: 0,
tips: ['无需依赖额外的样式文件','使用tn-number-box组件'],
sectionList: [
{
name: '参数切换',
section: [
{
title: '初始值',
optional: ['0','1','2.5','3','4','5'],
methods: 'valueChange'
},
{
title: '最小最大值',
optional: ['0-100','50-1000'],
methods: 'minMaxChange'
},
{
title: '步进值',
optional: ['1','5','0.5'],
methods: 'stepChange'
},
{
title: '只允许输入正整数',
optional: ['是','否'],
methods: 'positiveIntegerChange'
},
{
title: '禁用状态',
optional: ['是','否'],
methods: 'disabledChange',
current: 1
},
{
title: '禁用输入状态',
optional: ['是','否'],
methods: 'disabledInputChange',
current: 1
},
{
title: '自定义尺寸',
optional: ['默认','自定义'],
methods: 'customSizeChange'
},
{
title: '自定义颜色',
optional: ['默认','自定义'],
methods: 'customColorChange'
}
]
}
]
value1: 0,
value2: 0,
value3: 0,
value4: 0,
value5: 0,
value6: 0,
value7: 0
}
},
methods: {
click(event) {
this[event.methods] && this[event.methods](event)
},
// 切换初始值
valueChange(event) {
this.value = Number(event.name)
},
// 切换最小最大值
minMaxChange(event) {
const value = event.name.split('-')
this.min = Number(value[0])
this.max = Number(value[1])
},
// 切换步进值
stepChange(event) {
this.step = Number(event.name)
},
// 切换允许正整数状态
positiveIntegerChange(event) {
this.positiveInteger = event.index === 0 ? true : false
},
// 切换禁用状态
disabledChange(event) {
this.disabled = event.index === 0 ? true : false
},
// 切换禁用输入状态
disabledInputChange(event) {
this.disabledInput = event.index === 0 ? true : false
},
// 切换自定义尺寸
customSizeChange(event) {
switch(event.index) {
case 0:
this.inputWidth = 88
this.inputHeight = 50
this.fontSize = 0
break
case 1:
this.inputWidth = 120
this.inputHeight = 60
this.fontSize = 40
break
}
},
// 切换自定义颜色
customColorChange(event) {
switch(event.index) {
case 0:
this.backgroundColor = '#E6E6E6'
this.fontColor = ''
break
case 1:
this.backgroundColor = '#AAAAAA'
this.fontColor = 'tn-color-grey'
break
}
},
},
}
}
</script>
<style lang="scss" scoped>
.components-number_box {
min-height: 100vh;
}
</style>