mirror of
https://gitee.com/TSpecific/tuniao-ui.git
synced 2026-06-08 04:23:17 +08:00
修改$t为$tn
修改部分函数api的名称
This commit is contained in:
@@ -139,7 +139,7 @@
|
||||
}
|
||||
},
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
@click="handleClick"
|
||||
>
|
||||
<slot v-if="!dot"></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -110,10 +110,10 @@
|
||||
}
|
||||
|
||||
if (this.top) {
|
||||
style.top = this.$t.string.getLengthUnitValue(this.top)
|
||||
style.top = this.$tn.string.getLengthUnitValue(this.top)
|
||||
}
|
||||
if (this.right) {
|
||||
style.right = this.$t.string.getLengthUnitValue(this.right)
|
||||
style.right = this.$tn.string.getLengthUnitValue(this.right)
|
||||
}
|
||||
|
||||
return style
|
||||
@@ -136,9 +136,9 @@
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tn-badge {
|
||||
width: auto;
|
||||
@@ -169,5 +169,5 @@
|
||||
&--center-position {
|
||||
transform: translate(50%, -50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -86,9 +86,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tn-popup>
|
||||
</template>
|
||||
|
||||
</tn-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Calendar from '../../libs/utils/calendar.js'
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
return `${this.mode}-${this.minDate}-${this.maxDate}`
|
||||
},
|
||||
elIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
},
|
||||
colorValue() {
|
||||
return (index, type) => {
|
||||
@@ -537,9 +537,9 @@
|
||||
this.$emit('input', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-calendar {
|
||||
@@ -703,5 +703,5 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-car-keyboard',
|
||||
@@ -102,7 +102,7 @@
|
||||
'警'
|
||||
]
|
||||
// 打乱顺序
|
||||
if (this.randomEnabled) data = this.$t.array.random(data)
|
||||
if (this.randomEnabled) data = this.$tn.array.random(data)
|
||||
// 切割二维数组
|
||||
let showData = []
|
||||
showData[0] = data.slice(0, 10)
|
||||
@@ -151,7 +151,7 @@
|
||||
'M'
|
||||
]
|
||||
// 打乱顺序
|
||||
if (this.randomEnabled) data = this.$t.array.random(data)
|
||||
if (this.randomEnabled) data = this.$tn.array.random(data)
|
||||
// 切割二维数组
|
||||
let showData = []
|
||||
showData[0] = data.slice(0, 10)
|
||||
@@ -215,9 +215,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-car-keyboard {
|
||||
@@ -316,5 +316,5 @@
|
||||
&--hover {
|
||||
background-color: #E6E6E6 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-checkbox',
|
||||
@@ -181,7 +181,7 @@
|
||||
},
|
||||
created() {
|
||||
// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环应用
|
||||
// this.parent = this.$t.$parent.call(this, 'tn-checkbox-group')
|
||||
// this.parent = this.$tn.$parent.call(this, 'tn-checkbox-group')
|
||||
// // 如果存在u-checkbox-group,将本组件的this塞进父组件的children中
|
||||
// this.parent && this.parent.children.push(this)
|
||||
// // 初始化父组件的value值
|
||||
@@ -239,7 +239,7 @@
|
||||
} else {
|
||||
// 超出最大可选项,弹出提示
|
||||
if (this.parentData.value.length >= this.parentData.max) {
|
||||
return this.$t.message.toast(`最多可选${this.parent.max}项`)
|
||||
return this.$tn.message.toast(`最多可选${this.parent.max}项`)
|
||||
}
|
||||
// 如果原来为未选中状态,需要选中的数量少于父组件中设置的max值,才可以选中
|
||||
this.emitEvent();
|
||||
@@ -252,9 +252,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-checkbox {
|
||||
@@ -324,5 +324,5 @@
|
||||
color: $tn-font-sub-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
<slot v-if="$slots.default || $slots.$default"></slot>
|
||||
<view v-else-if="showPercent" class="tn-circle-progress__content__percent">{{ percent + '%' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-circle-progress',
|
||||
@@ -89,14 +89,14 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 微信小程序中不能使用this.$t.uuid()形式动态生成id值,否则会报错
|
||||
// 微信小程序中不能使用this.$tn.uuid()形式动态生成id值,否则会报错
|
||||
// #ifdef MP-WEIXIN
|
||||
elBgId: 'tCircleProgressBgId',
|
||||
elId: 'tCircleProgressElId',
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
elBgId: this.$t.uuid(),
|
||||
elId: this.$t.uuid(),
|
||||
elBgId: this.$tn.uuid(),
|
||||
elId: this.$tn.uuid(),
|
||||
// #endif
|
||||
// 活动圆上下文
|
||||
progressContext: null,
|
||||
@@ -188,9 +188,9 @@
|
||||
}, preSecondTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-circle-progress {
|
||||
@@ -219,5 +219,5 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-collapse-item',
|
||||
@@ -101,7 +101,7 @@
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
elId: this.$t.uuid(),
|
||||
elId: this.$tn.uuid(),
|
||||
// body高度
|
||||
height: 0,
|
||||
// 头部样式
|
||||
@@ -133,7 +133,7 @@
|
||||
methods: {
|
||||
// 异步获取内容或者修改了内容时重新获取内容的信息
|
||||
init() {
|
||||
this.parent = this.$t.$parent.call(this, 'tn-collapse')
|
||||
this.parent = this.$tn.$parent.call(this, 'tn-collapse')
|
||||
if (this.parent) {
|
||||
this.nameSync = this.name ? this.name : this.parent.childrens.length
|
||||
// 不存在才添加对应实例
|
||||
@@ -178,9 +178,9 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-collapse-item {
|
||||
@@ -232,5 +232,5 @@
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
>
|
||||
秒
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -168,7 +168,7 @@
|
||||
itemStyle() {
|
||||
let style = {}
|
||||
if (this.height) {
|
||||
style.height = this.$t.string.getLengthUnitValue(this.height)
|
||||
style.height = this.$tn.string.getLengthUnitValue(this.height)
|
||||
style.width = style.height
|
||||
}
|
||||
if (this.showBorder) {
|
||||
@@ -250,10 +250,10 @@
|
||||
minute = Math.floor(seconds / 60) - (hour * 60) - (day * 24 * 60)
|
||||
second = Math.floor(seconds) - (minute * 60) - (hour * 60 * 60) - (day * 24 * 60 * 60)
|
||||
// 如果小于0在前面进行补0操作
|
||||
showHour = this.$t.number.formatNumberAddZero(showHour)
|
||||
minute = this.$t.number.formatNumberAddZero(minute)
|
||||
second = this.$t.number.formatNumberAddZero(second)
|
||||
day = this.$t.number.formatNumberAddZero(day)
|
||||
showHour = this.$tn.number.formatNumberAddZero(showHour)
|
||||
minute = this.$tn.number.formatNumberAddZero(minute)
|
||||
second = this.$tn.number.formatNumberAddZero(second)
|
||||
day = this.$tn.number.formatNumberAddZero(day)
|
||||
|
||||
this.d = day
|
||||
this.h = showHour
|
||||
@@ -273,9 +273,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-countdown {
|
||||
@@ -310,5 +310,5 @@
|
||||
padding: 0 5rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:key="index"
|
||||
class="tn-count-scroll__box"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(width),
|
||||
width: $tn.string.getLengthUnitValue(width),
|
||||
height: heightPxValue + 'px'
|
||||
}"
|
||||
>
|
||||
@@ -33,9 +33,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -139,9 +139,9 @@
|
||||
this.keys = indexs
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-count-scroll {
|
||||
@@ -167,5 +167,5 @@
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
class="tn-fab__box"
|
||||
:class="{'tn-fab--right': left === 'auto'}"
|
||||
:style="{
|
||||
left: $t.string.getLengthUnitValue(fabLeft || left),
|
||||
right: $t.string.getLengthUnitValue(fabRight || right),
|
||||
bottom: $t.string.getLengthUnitValue(fabBottom || bottom),
|
||||
left: $tn.string.getLengthUnitValue(fabLeft || left),
|
||||
right: $tn.string.getLengthUnitValue(fabRight || right),
|
||||
bottom: $tn.string.getLengthUnitValue(fabBottom || bottom),
|
||||
zIndex: elZIndex
|
||||
}"
|
||||
>
|
||||
@@ -34,7 +34,7 @@
|
||||
:class="[left === 'auto' ? 'tn-fab__item__text--right' : 'tn-fab__item__text--left']"
|
||||
:style="{
|
||||
color: item.textColor || '#FFF',
|
||||
fontSize: $t.string.getLengthUnitValue(item.textSize || 28)
|
||||
fontSize: $tn.string.getLengthUnitValue(item.textSize || 28)
|
||||
}"
|
||||
>{{ item.text || '' }}</view>
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
class="tn-fab__item__btn"
|
||||
:class="[!item.bgColor ? backgroundColorClass : '']"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(width),
|
||||
height: $t.string.getLengthUnitValue(height),
|
||||
lineHeight: $t.string.getLengthUnitValue(height),
|
||||
width: $tn.string.getLengthUnitValue(width),
|
||||
height: $tn.string.getLengthUnitValue(height),
|
||||
lineHeight: $tn.string.getLengthUnitValue(height),
|
||||
backgroundColor: item.bgColor || backgroundColorStyle || '#01BEFF',
|
||||
borderRadius: $t.string.getLengthUnitValue(radius)
|
||||
borderRadius: $tn.string.getLengthUnitValue(radius)
|
||||
}"
|
||||
>
|
||||
<!-- 无图片和无图标时只显示文字 -->
|
||||
@@ -56,7 +56,7 @@
|
||||
class="tn-fab__item__btn__title"
|
||||
:style="{
|
||||
color: item.textColor || '#fff',
|
||||
fontSize: $t.string.getLengthUnitValue(item.textSize || 28)
|
||||
fontSize: $tn.string.getLengthUnitValue(item.textSize || 28)
|
||||
}"
|
||||
>{{ item.text || '' }}</view>
|
||||
<!-- 图标 -->
|
||||
@@ -66,7 +66,7 @@
|
||||
:class="[`tn-icon-${item.icon}`]"
|
||||
:style="{
|
||||
color: item.iconColor || '#fff',
|
||||
fontSize: $t.string.getLengthUnitValue(item.iconSize || iconSize || 64)
|
||||
fontSize: $tn.string.getLengthUnitValue(item.iconSize || iconSize || 64)
|
||||
}"
|
||||
></view>
|
||||
<!-- 图片 -->
|
||||
@@ -74,8 +74,8 @@
|
||||
v-else-if="!item.icon && item.imgUrl"
|
||||
class="tn-fab__item__btn__image"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(item.imgWidth || 64),
|
||||
height: $t.string.getLengthUnitValue(item.imgHeight || 64),
|
||||
width: $tn.string.getLengthUnitValue(item.imgWidth || 64),
|
||||
height: $tn.string.getLengthUnitValue(item.imgHeight || 64),
|
||||
}"
|
||||
:src="item.imgUrl"
|
||||
></image>
|
||||
@@ -87,24 +87,24 @@
|
||||
class="tn-fab__item__btn tn-fab__item__btn--fab"
|
||||
:class="[backgroundColorClass, fontColorClass, {'tn-fab__item__btn--active': showFab}]"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(width),
|
||||
height: $t.string.getLengthUnitValue(height),
|
||||
width: $tn.string.getLengthUnitValue(width),
|
||||
height: $tn.string.getLengthUnitValue(height),
|
||||
backgroundColor: backgroundColorStyle || !backgroundColorClass ? '#01BEFF' : '',
|
||||
color: fontColorStyle || '#fff',
|
||||
borderRadius: $t.string.getLengthUnitValue(radius),
|
||||
borderRadius: $tn.string.getLengthUnitValue(radius),
|
||||
zIndex: elZIndex - 1
|
||||
}"
|
||||
@tap.stop="fabClick"
|
||||
>
|
||||
<slot>
|
||||
<view class="tn-fab__item__btn__icon" :class="[`tn-icon-${icon}`]" :style="{fontSize: $t.string.getLengthUnitValue(iconSize || 64)}"></view>
|
||||
<view class="tn-fab__item__btn__icon" :class="[`tn-icon-${icon}`]" :style="{fontSize: $tn.string.getLengthUnitValue(iconSize || 64)}"></view>
|
||||
</slot>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="visibleSync && showMask" class="tn-fab__mask" :class="{'tn-fab__mask--visible': showFab}" :style="{zIndex: elZIndex - 3}" @tap="clickMask()"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -234,7 +234,7 @@
|
||||
},
|
||||
computed: {
|
||||
elZIndex() {
|
||||
return this.zIndex || this.$t.zIndex.fab
|
||||
return this.zIndex || this.$tn.zIndex.fab
|
||||
},
|
||||
propsData() {
|
||||
return [this.width, this.height, this.left, this.right, this.bottom]
|
||||
@@ -380,9 +380,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-fab {
|
||||
@@ -519,5 +519,5 @@
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
mounted() {
|
||||
// 组件创建完成后,保存当前实例到form组件中
|
||||
// 支付宝、头条小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环应用\
|
||||
this.parent = this.$t.$parent.call(this, 'tn-form')
|
||||
this.parent = this.$tn.$parent.call(this, 'tn-form')
|
||||
if (this.parent) {
|
||||
// 遍历parentData属性,将parent中同名的属性赋值给parentData
|
||||
Object.keys(this.parentData).map(key => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view class="tn-form-class tn-form">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-form',
|
||||
@@ -122,7 +122,7 @@
|
||||
if (this.errorType.indexOf('none') === -1 &&
|
||||
this.errorType.indexOf('toast') >= 0 &&
|
||||
errors.length > 0) {
|
||||
this.$t.message.toast(errors[0])
|
||||
this.$tn.message.toast(errors[0])
|
||||
}
|
||||
// 调用回调方法
|
||||
if (typeof callback == 'function') callback(valid)
|
||||
@@ -132,8 +132,8 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
||||
@@ -144,17 +144,17 @@
|
||||
},
|
||||
computed: {
|
||||
backgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
},
|
||||
backgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
},
|
||||
navStyle() {
|
||||
let style = {}
|
||||
if (this.height) {
|
||||
style.height = this.height + 'rpx'
|
||||
}
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$t.zIndex.goodsNav
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$tn.zIndex.goodsNav
|
||||
return style
|
||||
},
|
||||
// 选项style
|
||||
@@ -182,7 +182,7 @@
|
||||
clazz += ` ${item.colorClass}`
|
||||
}
|
||||
|
||||
clazz += ` buttons__item--${this.$t.string.humpConvertChar(this.buttonType, '-')}`
|
||||
clazz += ` buttons__item--${this.$tn.string.humpConvertChar(this.buttonType, '-')}`
|
||||
|
||||
return clazz
|
||||
}
|
||||
@@ -245,7 +245,7 @@
|
||||
let option = {...item}
|
||||
option.showAvatar = item.hasOwnProperty('avatar')
|
||||
if (item.hasOwnProperty('count')) {
|
||||
const count = this.$t.number.formatNumberString(item.count, 2)
|
||||
const count = this.$tn.number.formatNumberString(item.count, 2)
|
||||
option.showBadge = true
|
||||
option.count = typeof count === 'number' ? String(count) : count
|
||||
option.countBackgroundColor = item.countBackgroundColor ? item.countBackgroundColor : '#01BEFF'
|
||||
@@ -260,12 +260,12 @@
|
||||
this.buttonGroupsData = this.buttonGroups.map((item) => {
|
||||
let button = {...item}
|
||||
if (item.hasOwnProperty('backgroundColor')) {
|
||||
button.backgroundColorClass = this.$t.color.getBackgroundColorInternalClass(item.backgroundColor)
|
||||
button.backgroundColorStyle = this.$t.color.getBackgroundColorStyle(item.backgroundColor)
|
||||
button.backgroundColorClass = this.$tn.color.getBackgroundColorInternalClass(item.backgroundColor)
|
||||
button.backgroundColorStyle = this.$tn.color.getBackgroundColorStyle(item.backgroundColor)
|
||||
}
|
||||
if (item.hasOwnProperty('color')) {
|
||||
button.colorClass = this.$t.color.getBackgroundColorInternalClass(item.color)
|
||||
button.colorStyle = this.$t.color.getBackgroundColorStyle(item.color)
|
||||
button.colorClass = this.$tn.color.getBackgroundColorInternalClass(item.color)
|
||||
button.colorStyle = this.$tn.color.getBackgroundColorStyle(item.color)
|
||||
}
|
||||
return button
|
||||
})
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
:key="index"
|
||||
class="tn-image-upload__item tn-image-upload__item-preview"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(width),
|
||||
height: $t.string.getLengthUnitValue(height)
|
||||
width: $tn.string.getLengthUnitValue(width),
|
||||
height: $tn.string.getLengthUnitValue(height)
|
||||
}"
|
||||
>
|
||||
<!-- 删除按钮 -->
|
||||
@@ -62,8 +62,8 @@
|
||||
hover-class="tn-hover-class"
|
||||
hover-stay-time="150"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(width),
|
||||
height: $t.string.getLengthUnitValue(height)
|
||||
width: $tn.string.getLengthUnitValue(width),
|
||||
height: $tn.string.getLengthUnitValue(height)
|
||||
}"
|
||||
>
|
||||
<view class="tn-image-upload__item-add--icon tn-icon-add"></view>
|
||||
@@ -342,7 +342,7 @@
|
||||
// 提示用户信息
|
||||
showToast(message, force = false) {
|
||||
if (this.showTips || force) {
|
||||
this.$t.message.toast(message)
|
||||
this.$tn.message.toast(message)
|
||||
}
|
||||
},
|
||||
// 手动上传,通过ref进行调用
|
||||
@@ -354,7 +354,7 @@
|
||||
this.lists[index].progress = 0
|
||||
this.lists[index].error = false
|
||||
this.lists[index].response = null
|
||||
this.$t.message.loading('重新上传')
|
||||
this.$tn.message.loading('重新上传')
|
||||
this.uploadFile(index)
|
||||
},
|
||||
// 上传文件
|
||||
@@ -378,7 +378,7 @@
|
||||
// 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文
|
||||
// 因为upload组件可能会被嵌套在其他组件内,比如tn-form,这时this.$parent其实为tn-form的this,
|
||||
// 非页面的this,所以这里需要往上历遍,一直寻找到最顶端的$parent,这里用了this.$u.$parent.call(this)
|
||||
let beforeResponse = this.beforeUpload.bind(this.$t.$parent.call(this))(index, this.lists)
|
||||
let beforeResponse = this.beforeUpload.bind(this.$tn.$parent.call(this))(index, this.lists)
|
||||
// 判断是否返回了Promise
|
||||
if (!!beforeResponse && typeof beforeResponse.then === 'function') {
|
||||
await beforeResponse.then(res => {
|
||||
@@ -410,7 +410,7 @@
|
||||
header: this.header,
|
||||
success: res => {
|
||||
// 判断啊是否为json字符串,将其转换为json格式
|
||||
let data = this.toJson && this.$t.test.jsonString(res.data) ? JSON.parse(res.data) : res.data
|
||||
let data = this.toJson && this.$tn.test.jsonString(res.data) ? JSON.parse(res.data) : res.data
|
||||
if (![200, 201, 204].includes(res.statusCode)) {
|
||||
this.uploadError(index, data)
|
||||
} else {
|
||||
@@ -424,7 +424,7 @@
|
||||
this.uploadError(index, err)
|
||||
},
|
||||
complete: res => {
|
||||
this.$t.message.closeLoading()
|
||||
this.$tn.message.closeLoading()
|
||||
this.uploading = false
|
||||
this.uploadFile(index + 1)
|
||||
this.$emit('on-change', res, index, this.lists, this.index)
|
||||
@@ -449,14 +449,14 @@
|
||||
// 删除一个图片
|
||||
deleteItem(index) {
|
||||
if (!this.deleteable) return
|
||||
this.$t.message.modal(
|
||||
this.$tn.message.modal(
|
||||
'提示',
|
||||
'您确定要删除吗?',
|
||||
async () => {
|
||||
// 先检查是否有定义before-remove移除前钩子
|
||||
// 执行before-remove钩子
|
||||
if (this.beforeRemove && typeof(this.beforeRemove) === 'function') {
|
||||
let beforeResponse = this.beforeRemove.bind(this.$t.$parent.call(this))(index, this.lists)
|
||||
let beforeResponse = this.beforeRemove.bind(this.$tn.$parent.call(this))(index, this.lists)
|
||||
// 判断是否返回promise
|
||||
if (!!beforeResponse && typeof beforeResponse.then === 'function') {
|
||||
await beforeResponse.then(res => {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-index-anchor',
|
||||
@@ -43,7 +43,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
elId: this.$t.uuid(),
|
||||
elId: this.$tn.uuid(),
|
||||
// 内容的高度
|
||||
height: 0,
|
||||
// 内容的top
|
||||
@@ -59,15 +59,15 @@
|
||||
this.parent = false
|
||||
},
|
||||
mounted() {
|
||||
this.parent = this.$t.$parent.call(this, 'tn-index-list')
|
||||
this.parent = this.$tn.$parent.call(this, 'tn-index-list')
|
||||
if (this.parent) {
|
||||
this.parent.childrens.push(this)
|
||||
this.parent.updateData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-index-anchor {
|
||||
@@ -86,5 +86,5 @@
|
||||
color: $tn-main-color;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
<text>{{ indexList[touchMoveIndex] }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 生成 A-Z的字母列表
|
||||
let indexList = function() {
|
||||
@@ -96,7 +96,7 @@
|
||||
computed: {
|
||||
// 选中索引列表弹出提示框的z-index
|
||||
selectAlertZIndex() {
|
||||
return this.$t.zIndex.toast
|
||||
return this.$tn.zIndex.toast
|
||||
},
|
||||
// 吸顶的偏移高度
|
||||
stickyOffsetTop() {
|
||||
@@ -223,7 +223,7 @@
|
||||
anchorStyle = {
|
||||
position: 'fixed',
|
||||
top: `${stickyOffsetTop}px`,
|
||||
zIndex: `${zIndex ? zIndex : this.$t.zIndex.indexListSticky}`,
|
||||
zIndex: `${zIndex ? zIndex : this.$tn.zIndex.indexListSticky}`,
|
||||
color: `${activeColor}`
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@
|
||||
const anchorStyle = {
|
||||
position: 'relative',
|
||||
transform: `translate3d(0, ${translateY}px, 0)`,
|
||||
zIndex: `${zIndex ? zIndex : this.$t.zIndex.indexListSticky}`,
|
||||
zIndex: `${zIndex ? zIndex : this.$tn.zIndex.indexListSticky}`,
|
||||
color: `${activeColor}`
|
||||
}
|
||||
item.active = false
|
||||
@@ -308,9 +308,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-index-list {
|
||||
@@ -357,5 +357,5 @@
|
||||
line-height: 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
handleInput(event) {
|
||||
let value = event.detail.value
|
||||
// 是否需要去掉空格
|
||||
if (this.trim) value = this.$t.string.trim(value)
|
||||
if (this.trim) value = this.$tn.string.trim(value)
|
||||
// 原生事件
|
||||
this.$emit('input', value)
|
||||
// model赋值
|
||||
@@ -304,7 +304,7 @@
|
||||
setTimeout(() => {
|
||||
// 头条小程序由于自身bug,导致中文下,每按下一个键(尚未完成输入),都会触发一次@input,导致错误,这里进行判断处理
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.$t.string.trim(value) === this.lastValue) return
|
||||
if (this.$tn.string.trim(value) === this.lastValue) return
|
||||
this.lastValue = value
|
||||
// #endif
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
setTimeout(() => {
|
||||
// 头条小程序由于自身bug,导致中文下,每按下一个键(尚未完成输入),都会触发一次@input,导致错误,这里进行判断处理
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.$t.string.trim(value) === this.lastValue) return
|
||||
if (this.$tn.string.trim(value) === this.lastValue) return
|
||||
this.lastValue = value
|
||||
// #endif
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
<tn-car-keyboard :randomEnabled="randomEnabled" :switchEnMode="switchEnMode" @change="change" @backspace="backspaceClick"></tn-car-keyboard>
|
||||
</block>
|
||||
</tn-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-keyboard',
|
||||
@@ -139,7 +139,7 @@
|
||||
},
|
||||
computed: {
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -171,9 +171,9 @@
|
||||
this.$emit('backspace')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-keyboard {
|
||||
@@ -216,5 +216,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
:style="[maskStyle]"
|
||||
@tap="closeMask"
|
||||
></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-landscape',
|
||||
@@ -97,7 +97,7 @@
|
||||
computed: {
|
||||
containerStyle() {
|
||||
let style = {}
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$t.zIndex.landsacpe
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$tn.zIndex.landsacpe
|
||||
return style
|
||||
},
|
||||
closeBtnStyle() {
|
||||
@@ -131,7 +131,7 @@
|
||||
},
|
||||
maskStyle() {
|
||||
let style = {}
|
||||
style.zIndex = this.zIndex ? this.zIndex - 1 : this.$t.zIndex.landsacpe - 1
|
||||
style.zIndex = this.zIndex ? this.zIndex - 1 : this.$tn.zIndex.landsacpe - 1
|
||||
return style
|
||||
}
|
||||
},
|
||||
@@ -160,9 +160,9 @@
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tn-landscape {
|
||||
width: 100%;
|
||||
@@ -221,5 +221,5 @@
|
||||
transform: scale3d(1, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@
|
||||
<view
|
||||
class="tn-line-progress--active"
|
||||
:class="[
|
||||
$t.color.getBackgroundColorInternalClass(activeColor),
|
||||
$tn.color.getBackgroundColorInternalClass(activeColor),
|
||||
striped ? stripedAnimation ? 'tn-line-progress__striped tn-line-progress__striped--active' : 'tn-line-progress__striped' : '',
|
||||
]"
|
||||
:style="[progressActiveStyle]"
|
||||
@@ -70,7 +70,7 @@
|
||||
let style = {}
|
||||
style.borderRadius = this.round ? '100rpx' : 0
|
||||
if (this.height) {
|
||||
style.height = this.$t.string.getLengthUnitValue(this.height)
|
||||
style.height = this.$tn.string.getLengthUnitValue(this.height)
|
||||
}
|
||||
if (this.inactiveColor) {
|
||||
style.backgroundColor = this.inactiveColor
|
||||
@@ -80,8 +80,8 @@
|
||||
progressActiveStyle() {
|
||||
let style = {}
|
||||
style.width = this.percent + '%'
|
||||
if (this.$t.color.getBackgroundColorStyle(this.activeColor)) {
|
||||
style.backgroundColor = this.$t.color.getBackgroundColorStyle(this.activeColor)
|
||||
if (this.$tn.color.getBackgroundColorStyle(this.activeColor)) {
|
||||
style.backgroundColor = this.$tn.color.getBackgroundColorStyle(this.activeColor)
|
||||
}
|
||||
return style
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
</view>
|
||||
<view class="tn-load-more__line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
if (this.fontSizeStyle) {
|
||||
style.fontSize = this.fontSizeStyle
|
||||
style.lineHeight = this.$t.string.getLengthUnitValue(this.fontSize + 2, this.fontUnit)
|
||||
style.lineHeight = this.$tn.string.getLengthUnitValue(this.fontSize + 2, this.fontUnit)
|
||||
}
|
||||
return style
|
||||
},
|
||||
@@ -129,9 +129,9 @@
|
||||
if (this.status === 'loadmore') this.$emit('loadmore')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tn-load-more {
|
||||
|
||||
@@ -184,5 +184,5 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
return style
|
||||
},
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.navbar
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.navbar
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -206,7 +206,7 @@
|
||||
// 如果获取失败则重新获取
|
||||
if (!customBarHeight) {
|
||||
try {
|
||||
const navBarInfo = await this.$t.updateCustomBar()
|
||||
const navBarInfo = await this.$tn.updateCustomBar()
|
||||
customBarHeight = navBarInfo.customBarHeight
|
||||
statusBarHeight = navBarInfo.statusBarHeight
|
||||
} catch(e) {
|
||||
@@ -218,8 +218,8 @@
|
||||
}
|
||||
|
||||
// 更新vuex中的导航栏信息
|
||||
this && this.$t.vuex('vuex_status_bar_height', statusBarHeight)
|
||||
this && this.$t.vuex('vuex_custom_bar_height', customBarHeight)
|
||||
this && this.$tn.vuex('vuex_status_bar_height', statusBarHeight)
|
||||
this && this.$tn.vuex('vuex_custom_bar_height', customBarHeight)
|
||||
|
||||
this.customBarHeight = customBarHeight
|
||||
this.statusBarHeight = statusBarHeight
|
||||
@@ -230,7 +230,7 @@
|
||||
// 执行回调,同时传入索引当作参数
|
||||
// 在微信,支付宝等环境(H5正常),会导致父组件定义的函数体中的this变成子组件的this
|
||||
// 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文
|
||||
let beforeBack = this.beforeBack.bind(this.$t.$parent.call(this))()
|
||||
let beforeBack = this.beforeBack.bind(this.$tn.$parent.call(this))()
|
||||
// 判断是否返回了Promise
|
||||
if (!!beforeBack && typeof beforeBack.then === 'function') {
|
||||
await beforeBack.then(res => {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
]"
|
||||
:style="{
|
||||
backgroundColor: backgroundColorStyle,
|
||||
height: $t.string.getLengthUnitValue(inputHeight),
|
||||
height: $tn.string.getLengthUnitValue(inputHeight),
|
||||
color: fontColorStyle,
|
||||
fontSize: fontSizeStyle
|
||||
}"
|
||||
@@ -31,8 +31,8 @@
|
||||
{'tn-number-box__input--disabled': disabledInput || disabled}
|
||||
]"
|
||||
:style="{
|
||||
width: $t.string.getLengthUnitValue(inputWidth),
|
||||
height: $t.string.getLengthUnitValue(inputHeight),
|
||||
width: $tn.string.getLengthUnitValue(inputWidth),
|
||||
height: $tn.string.getLengthUnitValue(inputHeight),
|
||||
color: fontColorStyle,
|
||||
fontSize: fontSizeStyle,
|
||||
backgroundColor: backgroundColorStyle
|
||||
@@ -51,7 +51,7 @@
|
||||
]"
|
||||
:style="{
|
||||
backgroundColor: backgroundColorStyle,
|
||||
height: $t.string.getLengthUnitValue(inputHeight),
|
||||
height: $tn.string.getLengthUnitValue(inputHeight),
|
||||
color: fontColorStyle,
|
||||
fontSize: fontSizeStyle
|
||||
}"
|
||||
@@ -60,9 +60,9 @@
|
||||
>
|
||||
<view class="tn-icon-add"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColor from '../../libs/mixin/components_color.js'
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
if (newVal === '') return
|
||||
let value = 0
|
||||
// 首先判断是否数值,并且在min和max之间,如果不是,使用原来值
|
||||
let isNumber = this.$t.test.number(newVal)
|
||||
let isNumber = this.$tn.test.number(newVal)
|
||||
if (isNumber && newVal >= this.min && newVal <= this.max) value = newVal
|
||||
else value = oldVal
|
||||
|
||||
@@ -347,9 +347,9 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-number-box {
|
||||
@@ -397,5 +397,5 @@
|
||||
background: $tn-font-holder-color !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
if (!this.randomEnabled) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, '', 0]
|
||||
} else {
|
||||
let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
data.splice(-1, 0, '')
|
||||
return data
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
if (!this.randomEnabled) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]
|
||||
} else {
|
||||
let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
data.splice(-1, 0, this.dot)
|
||||
return data
|
||||
}
|
||||
@@ -78,7 +78,7 @@
|
||||
if (!this.randomEnabled) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]
|
||||
} else {
|
||||
let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
|
||||
data.splice(-1, 0, this.cardX)
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
return [this.year, this.month]
|
||||
},
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -366,7 +366,7 @@
|
||||
},
|
||||
// 往数字前面补0
|
||||
formatNumber(num) {
|
||||
return this.$t.number.formatNumberAddZero(num)
|
||||
return this.$tn.number.formatNumberAddZero(num)
|
||||
},
|
||||
// 生成递进的数组
|
||||
generateArray(start, end) {
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
<view :class="[`tn-icon-${closeBtnIcon}`]" :style="[closeBtnStyle]"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -187,7 +187,7 @@
|
||||
popupStyle() {
|
||||
let style = {}
|
||||
if ((this.mode === 'top' || this.mode === 'left' || this.mode === 'right') && this.marginTop) {
|
||||
style.marginTop = this.$t.string.getLengthUnitValue(this.marginTop, 'px')
|
||||
style.marginTop = this.$tn.string.getLengthUnitValue(this.marginTop, 'px')
|
||||
}
|
||||
|
||||
return style
|
||||
@@ -198,14 +198,14 @@
|
||||
// 如果是左边或者上边弹出时,需要给translate设置为负值,用于隐藏
|
||||
if (this.mode === 'left' || this.mode === 'right') {
|
||||
style = {
|
||||
width: this.width ? this.$t.string.getLengthUnitValue(this.width) : this.$t.string.getLengthUnitValue(this.length),
|
||||
width: this.width ? this.$tn.string.getLengthUnitValue(this.width) : this.$tn.string.getLengthUnitValue(this.length),
|
||||
height: '100%',
|
||||
transform: `translate3D(${this.mode === 'left' ? '-100%' : '100%'}, 0px, 0px)`
|
||||
}
|
||||
} else if (this.mode === 'top' || this.mode === 'bottom') {
|
||||
style = {
|
||||
width: '100%',
|
||||
height: this.height ? this.$t.string.getLengthUnitValue(this.height) : this.$t.string.getLengthUnitValue(this.length),
|
||||
height: this.height ? this.$tn.string.getLengthUnitValue(this.height) : this.$tn.string.getLengthUnitValue(this.length),
|
||||
transform: `translate3D(0px, ${this.mode === 'top' ? '-100%': '100%'}, 0px)`
|
||||
}
|
||||
}
|
||||
@@ -238,12 +238,12 @@
|
||||
// 中部弹窗的样式
|
||||
centerStyle() {
|
||||
let style = {}
|
||||
style.width = this.width ? this.$t.string.getLengthUnitValue(this.width) : this.$t.string.getLengthUnitValue(this.length)
|
||||
style.width = this.width ? this.$tn.string.getLengthUnitValue(this.width) : this.$tn.string.getLengthUnitValue(this.length)
|
||||
// 中部弹出的模式,如果没有设置高度,就用auto值,由内容撑开
|
||||
style.height = this.height ? this.$t.string.getLengthUnitValue(this.height) : 'auto'
|
||||
style.height = this.height ? this.$tn.string.getLengthUnitValue(this.height) : 'auto'
|
||||
style.zIndex = this.elZIndex
|
||||
if (this.negativeTop) {
|
||||
style.marginTop = `-${this.$t.string.getLengthUnitValue(this.negativeTop)}`
|
||||
style.marginTop = `-${this.$tn.string.getLengthUnitValue(this.negativeTop)}`
|
||||
}
|
||||
if (this.borderRadius) {
|
||||
style.borderRadius = `${this.borderRadius}rpx`
|
||||
@@ -267,7 +267,7 @@
|
||||
return style
|
||||
},
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -350,9 +350,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-popup {
|
||||
@@ -487,5 +487,5 @@
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-rate',
|
||||
@@ -148,8 +148,8 @@
|
||||
return index => {
|
||||
let style = {}
|
||||
|
||||
style.fontSize = this.$t.string.getLengthUnitValue(this.size)
|
||||
style.padding = `0 ${this.$t.string.getLengthUnitValue(this.gutter / 2)}`
|
||||
style.fontSize = this.$tn.string.getLengthUnitValue(this.size)
|
||||
style.padding = `0 ${this.$tn.string.getLengthUnitValue(this.gutter / 2)}`
|
||||
// 当前图标的颜色
|
||||
if (this.allowHalf && this.halfIcon) {
|
||||
style.color = this.activeIndex > index + 1 ? this.elActionColor : this.inactiveColor
|
||||
@@ -163,8 +163,8 @@
|
||||
halfIconStyle() {
|
||||
let style = {}
|
||||
|
||||
style.fontSize = this.$t.string.getLengthUnitValue(this.size)
|
||||
style.padding = `0 ${this.$t.string.getLengthUnitValue(this.gutter / 2)}`
|
||||
style.fontSize = this.$tn.string.getLengthUnitValue(this.size)
|
||||
style.padding = `0 ${this.$tn.string.getLengthUnitValue(this.gutter / 2)}`
|
||||
style.color = this.elActionColor
|
||||
return style
|
||||
}
|
||||
@@ -172,8 +172,8 @@
|
||||
data() {
|
||||
return {
|
||||
// 保证控件的唯一性
|
||||
elId: this.$t.uuid(),
|
||||
elClass: this.$t.uuid(),
|
||||
elId: this.$tn.uuid(),
|
||||
elClass: this.$tn.uuid(),
|
||||
// 评分盒子左边到屏幕左边的距离,用于滑动选择时计算距离
|
||||
starBoxLeft: 0,
|
||||
// 当前激活的星星的序号
|
||||
@@ -303,9 +303,9 @@
|
||||
this.$emit('input', this.activeIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-rate {
|
||||
@@ -330,5 +330,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
||||
export default {
|
||||
@@ -127,7 +127,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
elId: this.$t.uuid(),
|
||||
elId: this.$tn.uuid(),
|
||||
// 标记是否已经初始化高度完成
|
||||
initHeight: false,
|
||||
// 是否需要隐藏一部分内容
|
||||
@@ -175,9 +175,9 @@
|
||||
this.$emit(this.showMore ? 'open' : 'closed', this.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-read-more {
|
||||
@@ -218,5 +218,5 @@
|
||||
margin-left: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</tn-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-select',
|
||||
@@ -138,7 +138,7 @@
|
||||
},
|
||||
computed: {
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.popup
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.popup
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -189,7 +189,7 @@
|
||||
setDefaultSelector() {
|
||||
// 如果没有传入默认值,生成用0填充长度为columnNum的数组
|
||||
this.defaultSelector = this.defaultValue.length === this.columnNum ? this.defaultValue : Array(this.columnNum).fill(0)
|
||||
this.lastSelectIndex = this.$t.deepClone(this.defaultSelector)
|
||||
this.lastSelectIndex = this.$tn.deepClone(this.defaultSelector)
|
||||
},
|
||||
// 计算列数
|
||||
setColumnNum() {
|
||||
@@ -310,9 +310,9 @@
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-select {
|
||||
@@ -376,5 +376,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<view style="position: fixed; left: -2000px;width: 0;height: 0;overflow: hidden;">
|
||||
<canvas canvas-id="temp-tn-sign-canvas" :style="{width: `${canvasHeight}px`, height: `${canvasHeight}px`}"></canvas>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-sign-board',
|
||||
@@ -290,14 +290,14 @@
|
||||
this.getRotateImage(res.tempFilePath).then((res) => {
|
||||
this.$emit('save', res)
|
||||
}).catch(err => {
|
||||
this.$t.message.toast('旋转图片失败')
|
||||
this.$tn.message.toast('旋转图片失败')
|
||||
})
|
||||
} else {
|
||||
this.$emit('save', res.tempFilePath)
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.$t.message.toast('保存失败')
|
||||
this.$tn.message.toast('保存失败')
|
||||
}
|
||||
}, this)
|
||||
},
|
||||
@@ -315,7 +315,7 @@
|
||||
urls: [res]
|
||||
})
|
||||
}).catch(err => {
|
||||
this.$t.message.toast('旋转图片失败')
|
||||
this.$tn.message.toast('旋转图片失败')
|
||||
})
|
||||
} else {
|
||||
uni.previewImage({
|
||||
@@ -324,13 +324,13 @@
|
||||
}
|
||||
},
|
||||
fail: (e) => {
|
||||
this.$t.message.toast('预览失败')
|
||||
this.$tn.message.toast('预览失败')
|
||||
}
|
||||
}, this)
|
||||
},
|
||||
// 关闭签名板
|
||||
closeBoard() {
|
||||
this.$t.message.modal('提示信息','关闭后内容将被清除,是否确认关闭',() => {
|
||||
this.$tn.message.modal('提示信息','关闭后内容将被清除,是否确认关闭',() => {
|
||||
this.$emit('closed')
|
||||
}, true)
|
||||
},
|
||||
@@ -595,9 +595,9 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-sign-board {
|
||||
@@ -686,5 +686,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
>
|
||||
<view
|
||||
v-for="(item, index) in rectNodes"
|
||||
:key="$t.uuid()"
|
||||
:key="$tn.uuid()"
|
||||
class="tn-skeleton__item tn-skeleton__item--rect"
|
||||
:class="[elBackgroundColorClass, {'tn-skeleton__item--fade': animation}]"
|
||||
:style="[itemStyle('rect', item)]"
|
||||
></view>
|
||||
<view
|
||||
v-for="(item, index) in circleNodes"
|
||||
:key="$t.uuid()"
|
||||
:key="$tn.uuid()"
|
||||
class="tn-skeleton__item tn-skeleton__item--circle"
|
||||
:class="[elBackgroundColorClass, {'tn-skeleton__item--fade': animation}]"
|
||||
:style="[itemStyle('circle', item)]"
|
||||
></view>
|
||||
<view
|
||||
v-for="(item, index) in filletNodes"
|
||||
:key="$t.uuid()"
|
||||
:key="$tn.uuid()"
|
||||
class="tn-skeleton__item tn-skeleton__item--fillet"
|
||||
:class="[elBackgroundColorClass, {'tn-skeleton__item--fade': animation}]"
|
||||
:style="[itemStyle('fillet', item)]"
|
||||
@@ -75,10 +75,10 @@
|
||||
},
|
||||
computed: {
|
||||
elBackgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.elBackgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.elBackgroundColor)
|
||||
},
|
||||
elBackgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.elBackgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.elBackgroundColor)
|
||||
},
|
||||
// 骨架屏样式
|
||||
skeletonStyle() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:style="[
|
||||
barStyle,
|
||||
{
|
||||
height: this.$t.string.getLengthUnitValue(lineHeight),
|
||||
height: this.$tn.string.getLengthUnitValue(lineHeight),
|
||||
backgroundColor: activeColor
|
||||
}
|
||||
]"
|
||||
@@ -33,16 +33,16 @@
|
||||
v-else
|
||||
class="tn-slider__button"
|
||||
:style="[blockStyle, {
|
||||
height: this.$t.string.getLengthUnitValue(blockWidth),
|
||||
width: this.$t.string.getLengthUnitValue(blockWidth),
|
||||
height: this.$tn.string.getLengthUnitValue(blockWidth),
|
||||
width: this.$tn.string.getLengthUnitValue(blockWidth),
|
||||
backgroundColor: blockColor
|
||||
}]"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-slider',
|
||||
@@ -210,9 +210,9 @@
|
||||
return Math.round(Math.max(this.min, Math.min(value, this.max)) / this.step) * this.step
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tn-slider {
|
||||
width: 100%;
|
||||
@@ -251,5 +251,5 @@
|
||||
&--disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -64,13 +64,13 @@
|
||||
},
|
||||
computed: {
|
||||
elZIndex() {
|
||||
return this.zIndex ? this.zIndex : this.$t.zIndex.sticky
|
||||
return this.zIndex ? this.zIndex : this.$tn.zIndex.sticky
|
||||
},
|
||||
backgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
},
|
||||
backgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
},
|
||||
stickyClass() {
|
||||
let clazz = ''
|
||||
@@ -97,7 +97,7 @@
|
||||
// 监听组件别名
|
||||
stickyObserverName: 'tnStickyObserver',
|
||||
// 组件的唯一编号
|
||||
elClass: this.$t.uuid(),
|
||||
elClass: this.$tn.uuid(),
|
||||
// 是否固定
|
||||
fixed: false,
|
||||
// 高度
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
},
|
||||
itemBarClass() {
|
||||
let clazz = ''
|
||||
const buttonBgClass = this.$t.color.getBackgroundColorInternalClass(this.buttonColor)
|
||||
const buttonBgClass = this.$tn.color.getBackgroundColorInternalClass(this.buttonColor)
|
||||
if (this.animation) {
|
||||
clazz += ' tn-subsection__bg__animation'
|
||||
if (this.animationType) {
|
||||
@@ -230,7 +230,7 @@
|
||||
// 滑块样式
|
||||
itemBarStyle() {
|
||||
let style = {}
|
||||
const buttonBgStyle = this.$t.color.getBackgroundColorStyle(this.buttonColor)
|
||||
const buttonBgStyle = this.$tn.color.getBackgroundColorStyle(this.buttonColor)
|
||||
if (buttonBgStyle) {
|
||||
style.backgroundColor = this.buttonColor
|
||||
}
|
||||
|
||||
@@ -177,10 +177,10 @@
|
||||
},
|
||||
computed: {
|
||||
backgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
},
|
||||
backgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
},
|
||||
swiperStyle() {
|
||||
let style = {}
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
!value ? 'tn-switch__icon--show' : ''
|
||||
]"
|
||||
:style="[iconStyle]"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tn-switch',
|
||||
@@ -105,7 +105,7 @@
|
||||
computed: {
|
||||
switchStyle() {
|
||||
let style = {}
|
||||
style.fontSize = this.$t.string.getLengthUnitValue(this.size)
|
||||
style.fontSize = this.$tn.string.getLengthUnitValue(this.size)
|
||||
style.backgroundColor = this.value ?
|
||||
this.activeColor ? this.activeColor : '#01BEFF' :
|
||||
this.inactiveColor ? this.inactiveColor : '#AAAAAA'
|
||||
@@ -113,14 +113,14 @@
|
||||
},
|
||||
switchNodeStyle() {
|
||||
let style = {}
|
||||
style.width = this.$t.string.getLengthUnitValue(this.size)
|
||||
style.width = this.$tn.string.getLengthUnitValue(this.size)
|
||||
style.height = style.width
|
||||
return style
|
||||
},
|
||||
iconStyle() {
|
||||
let style = {}
|
||||
style.fontSize = this.$t.string.getLengthUnitValue(this.size - 20)
|
||||
style.lineHeight = this.$t.string.getLengthUnitValue(this.size)
|
||||
style.fontSize = this.$tn.string.getLengthUnitValue(this.size - 20)
|
||||
style.lineHeight = this.$tn.string.getLengthUnitValue(this.size)
|
||||
return style
|
||||
},
|
||||
loadingColor() {
|
||||
@@ -144,9 +144,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-switch {
|
||||
@@ -237,5 +237,5 @@
|
||||
&--disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
:absolute="true"
|
||||
:top="2"
|
||||
>
|
||||
{{ $t.number.formatNumberString(item.count) }}
|
||||
{{ $tn.number.formatNumberString(item.count) }}
|
||||
</tn-badge>
|
||||
</view>
|
||||
|
||||
@@ -220,13 +220,13 @@
|
||||
}
|
||||
// 判断是否获取内部样式
|
||||
if (style) {
|
||||
if (this.$t.color.getFontColorStyle(color) !== '') {
|
||||
if (this.$tn.color.getFontColorStyle(color) !== '') {
|
||||
return color
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
if (this.$t.color.getFontColorStyle(color) === '') {
|
||||
if (this.$tn.color.getFontColorStyle(color) === '') {
|
||||
return color
|
||||
} else {
|
||||
return ''
|
||||
@@ -246,13 +246,13 @@
|
||||
}
|
||||
// 判断是否获取内部样式
|
||||
if (style) {
|
||||
if (this.$t.color.getFontColorStyle(color) !== '') {
|
||||
if (this.$tn.color.getFontColorStyle(color) !== '') {
|
||||
return color
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
if (this.$t.color.getFontColorStyle(color) === '') {
|
||||
if (this.$tn.color.getFontColorStyle(color) === '') {
|
||||
return color + ' tn-tabbar__content__item__icon--clip'
|
||||
} else {
|
||||
return ''
|
||||
@@ -277,7 +277,7 @@
|
||||
let clazz = ''
|
||||
if (this.list[index]['out']) {
|
||||
clazz += 'tn-tabbar__content__item__button--out'
|
||||
if (this.$t.color.getFontColorStyle(this.activeIconColor) === '') {
|
||||
if (this.$tn.color.getFontColorStyle(this.activeIconColor) === '') {
|
||||
clazz += ` ${this.activeIconColor}`
|
||||
}
|
||||
if (this.value === index) {
|
||||
@@ -297,7 +297,7 @@
|
||||
return (index) => {
|
||||
let style = {}
|
||||
if (this.list[index]['out']) {
|
||||
if (this.$t.color.getFontColorStyle(this.activeIconColor) !== '') {
|
||||
if (this.$tn.color.getFontColorStyle(this.activeIconColor) !== '') {
|
||||
style.backgroundColor = this.activeIconColor
|
||||
}
|
||||
style.width = `${this.outHeight - 35}rpx`
|
||||
@@ -378,7 +378,7 @@
|
||||
// 执行回调,同时传入索引当作参数
|
||||
// 在微信,支付宝等环境(H5正常),会导致父组件定义的函数体中的this变成子组件的this
|
||||
// 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文
|
||||
let beforeSwitch = this.beforeSwitch.bind(this.$t.$parent.call(this))(index)
|
||||
let beforeSwitch = this.beforeSwitch.bind(this.$tn.$parent.call(this))(index)
|
||||
// 判断是否返回了Promise
|
||||
if (!!beforeSwitch && typeof beforeSwitch.then === 'function') {
|
||||
await beforeSwitch.then(res => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="tn-tabs-swiper-class tn-tabs-swiper" :class="[backgroundColorClass]" :style="{backgroundColor: backgroundColorStyle, marginTop: $t.string.getLengthUnitValue(top, 'px'), zIndex: zIndex}">
|
||||
<view class="tn-tabs-swiper-class tn-tabs-swiper" :class="[backgroundColorClass]" :style="{backgroundColor: backgroundColorStyle, marginTop: $tn.string.getLengthUnitValue(top, 'px'), zIndex: zIndex}">
|
||||
|
||||
<scroll-view scroll-x class="tn-tabs-swiper__scroll-view" :scroll-left="scrollLeft" scroll-with-animation :style="{zIndex: zIndex + 1}">
|
||||
<view class="tn-tabs-swiper__scroll-view__box" :class="{'tn-tabs-swiper__scroll-view--flex': !isScroll}">
|
||||
@@ -171,8 +171,8 @@
|
||||
tabItemStyle() {
|
||||
return index => {
|
||||
let style = {
|
||||
height: this.$t.string.getLengthUnitValue(this.height),
|
||||
lineHeight: this.$t.string.getLengthUnitValue(this.height),
|
||||
height: this.$tn.string.getLengthUnitValue(this.height),
|
||||
lineHeight: this.$tn.string.getLengthUnitValue(this.height),
|
||||
fontSize: this.fontSizeStyle || '28rpx',
|
||||
color: this.tabsInfo.length > 0 ? (this.tabsInfo[index] ? this.tabsInfo[index].color : this.activeColor) : this.inactiveColor,
|
||||
padding: this.isScroll ? `0 ${this.gutter}rpx` : '',
|
||||
@@ -191,8 +191,8 @@
|
||||
// 底部滑块样式
|
||||
tabBarStyle() {
|
||||
let style = {
|
||||
width: this.$t.string.getLengthUnitValue(this.barWidth),
|
||||
height: this.$t.string.getLengthUnitValue(this.barHeight),
|
||||
width: this.$tn.string.getLengthUnitValue(this.barWidth),
|
||||
height: this.$tn.string.getLengthUnitValue(this.barHeight),
|
||||
borderRadius: `${this.barHeight / 2}rpx`,
|
||||
backgroundColor: this.activeColor,
|
||||
left: this.scrollBarLeft + 'px'
|
||||
@@ -245,7 +245,7 @@
|
||||
this.setScrollViewToCenter()
|
||||
})
|
||||
// 获取渐变颜色数组
|
||||
this.colorGradientArr = this.$t.color.colorGradient(this.inactiveColor, this.activeColor, this.colorStep)
|
||||
this.colorGradientArr = this.$tn.color.colorGradient(this.inactiveColor, this.activeColor, this.colorStep)
|
||||
},
|
||||
// 发送事件
|
||||
emit(index) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="tn-tabs-class tn-tabs" :class="[backgroundColorClass]" :style="{backgroundColor: backgroundColorStyle, marginTop: $t.string.getLengthUnitValue(top, 'px')}">
|
||||
<view class="tn-tabs-class tn-tabs" :class="[backgroundColorClass]" :style="{backgroundColor: backgroundColorStyle, marginTop: $tn.string.getLengthUnitValue(top, 'px')}">
|
||||
|
||||
<!-- _tgetRect()对组件根节点无效,因为写了.in(this),故这里获取内层接点尺寸 -->
|
||||
<view :id="id">
|
||||
@@ -140,8 +140,8 @@
|
||||
// 底部滑块样式
|
||||
tabBarStyle() {
|
||||
let style = {
|
||||
width: this.$t.string.getLengthUnitValue(this.barWidth),
|
||||
height: this.$t.string.getLengthUnitValue(this.barHeight),
|
||||
width: this.$tn.string.getLengthUnitValue(this.barWidth),
|
||||
height: this.$tn.string.getLengthUnitValue(this.barHeight),
|
||||
borderRadius: `${this.barHeight / 2}rpx`,
|
||||
backgroundColor: this.activeColor,
|
||||
opacity: this.barMoveFirst ? 0 : 1,
|
||||
@@ -155,9 +155,9 @@
|
||||
tabItemStyle() {
|
||||
return index => {
|
||||
let style = {
|
||||
width: this.$t.string.getLengthUnitValue(this.itemWidth),
|
||||
height: this.$t.string.getLengthUnitValue(this.height),
|
||||
lineHeight: this.$t.string.getLengthUnitValue(this.height),
|
||||
width: this.$tn.string.getLengthUnitValue(this.itemWidth),
|
||||
height: this.$tn.string.getLengthUnitValue(this.height),
|
||||
lineHeight: this.$tn.string.getLengthUnitValue(this.height),
|
||||
fontSize: this.fontSizeStyle || '28rpx',
|
||||
padding: this.isScroll ? `0 ${this.gutter}rpx` : '',
|
||||
flex: this.isScroll ? 'auto' : '1',
|
||||
@@ -179,7 +179,7 @@
|
||||
data() {
|
||||
return {
|
||||
// id值
|
||||
id: this.$t.uuid(),
|
||||
id: this.$tn.uuid(),
|
||||
// 滚动scroll-view的左边距离
|
||||
scrollLeft: 0,
|
||||
// 存放查询后tab菜单的节点信息
|
||||
|
||||
@@ -67,21 +67,21 @@
|
||||
if ((this.position === 'top' || this.position === '') && this.top) {
|
||||
style.top = this.top + 'px'
|
||||
}
|
||||
style.zIndex = (this.zIndex ? this.zIndex : this.$t.zIndex.tips) + 1
|
||||
style.zIndex = (this.zIndex ? this.zIndex : this.$tn.zIndex.tips) + 1
|
||||
|
||||
return style
|
||||
},
|
||||
backgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
},
|
||||
backgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
},
|
||||
fontColorStyle() {
|
||||
return this.$t.color.getFontColorStyle(this.fontColor)
|
||||
return this.$tn.color.getFontColorStyle(this.fontColor)
|
||||
},
|
||||
fontColorClass() {
|
||||
return this.$t.color.getFontColorInternalClass(this.fontColor)
|
||||
return this.$tn.color.getFontColorInternalClass(this.fontColor)
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
</view>
|
||||
|
||||
<view class="tn-toast__mask" :class="[visible ? 'tn-toast__mask--show' : '']" :style="[maskStyle]"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
@@ -58,13 +58,13 @@
|
||||
// style.width = this.content ? '420rpx' : '360rpx'
|
||||
}
|
||||
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$t.zIndex.toast
|
||||
style.zIndex = this.zIndex ? this.zIndex : this.$tn.zIndex.toast
|
||||
|
||||
return style
|
||||
},
|
||||
maskStyle() {
|
||||
let style = {}
|
||||
const zIndex = this.zIndex ? this.zIndex : this.$t.zIndex.toast
|
||||
const zIndex = this.zIndex ? this.zIndex : this.$tn.zIndex.toast
|
||||
style.zIndex = zIndex - 1
|
||||
return style
|
||||
},
|
||||
@@ -137,9 +137,9 @@
|
||||
this.image = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.tn-toast {
|
||||
@@ -223,5 +223,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</style>
|
||||
|
||||
+3
-3
@@ -38,7 +38,7 @@ import zIndex from './libs/config/zIndex.js'
|
||||
// 主题颜色信息
|
||||
import colorInfo from './libs/config/color.js'
|
||||
|
||||
const $t = {
|
||||
const $tn = {
|
||||
updateCustomBar: updateCustomBarInfo,
|
||||
color,
|
||||
message,
|
||||
@@ -54,7 +54,7 @@ const $t = {
|
||||
}
|
||||
|
||||
// 挂载到uni对象上
|
||||
uni.$t = $t
|
||||
uni.$tn = $tn
|
||||
|
||||
const install = Vue => {
|
||||
// 全局混入
|
||||
@@ -62,7 +62,7 @@ const install = Vue => {
|
||||
|
||||
// Filter格式化
|
||||
|
||||
Vue.prototype.$t = $t
|
||||
Vue.prototype.$tn = $tn
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -40,11 +40,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 双标签 end*/
|
||||
|
||||
page {
|
||||
// overflow-y: auto;
|
||||
}
|
||||
/* 双标签 end*/
|
||||
|
||||
/* #endif */
|
||||
/* 微信小程序编译后页面有组件名的元素,特别处理 end */
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
let color = [
|
||||
'red',
|
||||
'purplered',
|
||||
'purple',
|
||||
'bluepurple',
|
||||
'aquablue',
|
||||
'blue',
|
||||
'indigo',
|
||||
'cyan',
|
||||
'teal',
|
||||
'green',
|
||||
'yellowgreen',
|
||||
'lime',
|
||||
'yellow',
|
||||
'orangeyellow',
|
||||
'orange',
|
||||
'orangered',
|
||||
'brown',
|
||||
'grey',
|
||||
'gray'
|
||||
]
|
||||
|
||||
// 酷炫颜色的数量
|
||||
const COOL_BG_COLOR_COUNT = 16
|
||||
|
||||
/**
|
||||
* 获取图鸟配色颜色列表
|
||||
*/
|
||||
function getTuniaoColorList() {
|
||||
return color
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定类型的随机颜色对应的类
|
||||
* @param {String} type 颜色类型
|
||||
*/
|
||||
function getRandomColorClass(type = 'bg') {
|
||||
const index = Math.floor(Math.random() * color.length)
|
||||
const colorValue = color[index]
|
||||
|
||||
return 'tn-' + type + '-' + colorValue
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机获取酷炫背景对应的类
|
||||
*/
|
||||
function getRandomCoolBgClass() {
|
||||
const index = (Math.random() * COOL_BG_COLOR_COUNT) + 1
|
||||
return 'tn-cool-bg-color-' + Math.floor(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的值获取内部背景颜色类
|
||||
*
|
||||
* @param {String} backgroundColor 背景颜色信息
|
||||
*/
|
||||
function getBackgroundColorInternalClass(backgroundColor = '') {
|
||||
if (!backgroundColor) return ''
|
||||
|
||||
if (['tn-bg', 'tn-dynamic-bg', 'tn-main-gradient', 'tn-cool-bg'].some(item => {
|
||||
return backgroundColor.includes(item)
|
||||
})) {
|
||||
return backgroundColor
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的值获取背景颜色样式
|
||||
*
|
||||
* @param {String} backgroundColor 背景颜色信息
|
||||
*/
|
||||
function getBackgroundColorStyle(backgroundColor = '') {
|
||||
if (!backgroundColor) return ''
|
||||
|
||||
if (!backgroundColor.startsWith('tn-') || ['#', 'rgb', 'rgba'].some(item => {
|
||||
return backgroundColor.includes(item)
|
||||
})) {
|
||||
return backgroundColor
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的值获取内部字体颜色类
|
||||
*
|
||||
* @param {String} fontColor 背景颜色信息
|
||||
*/
|
||||
function getFontColorInternalClass(fontColor = '') {
|
||||
if (!fontColor) return ''
|
||||
|
||||
if (['tn-color'].some(item => {
|
||||
return fontColor.includes(item)
|
||||
})) {
|
||||
return fontColor
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的值获取字体颜色样式
|
||||
*
|
||||
* @param {String} fontColor 背景颜色信息
|
||||
*/
|
||||
function getFontColorStyle(fontColor = '') {
|
||||
if (!fontColor) return ''
|
||||
|
||||
if (!fontColor.startsWith('tn-') || ['#', 'rgb', 'rgba'].some(item => {
|
||||
return fontColor.includes(item)
|
||||
})) {
|
||||
return fontColor
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 求两个颜色之间的渐变值
|
||||
*
|
||||
* @param {String} startColor 开始颜色
|
||||
* @param {String} endColor 结束颜色
|
||||
* @param {Number} step 颜色等分的份额
|
||||
*/
|
||||
function colorGradient(startColor = 'rgb(0, 0, 0)', endColor='rgb(255, 255, 255)', step = 10) {
|
||||
let startRGB = hexToRGB(startColor, false)
|
||||
let startR = startRGB[0]
|
||||
let startG = startRGB[1]
|
||||
let startB = startRGB[2]
|
||||
|
||||
let endRGB = hexToRGB(endColor, false)
|
||||
let endR = endRGB[0]
|
||||
let endG = endRGB[1]
|
||||
let endB = endRGB[2]
|
||||
|
||||
// 求差值
|
||||
let R = (endR - startR) / step
|
||||
let G = (endG - startG) / step
|
||||
let B = (endB - startB) / step
|
||||
|
||||
let colorArr = []
|
||||
for (let i = 0; i < step; i++) {
|
||||
// 计算每一步的hex值
|
||||
let hex = rgbToHex(`rgb(${Math.round(R * i + startR)}, ${Math.round(G * i + startG)}, ${Math.round(B * i + startB)})`)
|
||||
colorArr.push(hex)
|
||||
}
|
||||
return colorArr
|
||||
}
|
||||
|
||||
/**
|
||||
* 将hex的颜色表示方式转换为rgb表示方式
|
||||
*
|
||||
* @param {String} color 颜色
|
||||
* @param {Boolean} str 是否返回字符串
|
||||
* @return {Array|String} rgb的值
|
||||
*/
|
||||
function hexToRGB(color, str = true) {
|
||||
let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
||||
|
||||
color = color.toLowerCase()
|
||||
if (color && reg.test(color)) {
|
||||
// #000 => #000000
|
||||
if (color.length === 4) {
|
||||
let colorNew = '#'
|
||||
for (let i = 1; i < 4; i++) {
|
||||
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
||||
}
|
||||
color = colorNew
|
||||
}
|
||||
// 处理六位的颜色值
|
||||
let colorChange = []
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
colorChange.push(parseInt("0x" + color.slice(i, i + 2)))
|
||||
}
|
||||
if (!str) {
|
||||
return colorChange
|
||||
} else {
|
||||
return `rgb(${colorChange[0]}, ${colorChange[1]}, ${colorChange[2]})`
|
||||
}
|
||||
} else if (/^(rgb|RGB)/.test(color)) {
|
||||
let arr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(',')
|
||||
return arr.map(item => Number(item))
|
||||
} else {
|
||||
return color
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将rgb的颜色表示方式转换成hex表示方式
|
||||
*
|
||||
* @param {Object} rgb rgb颜色值
|
||||
*/
|
||||
function rgbToHex(rgb) {
|
||||
let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
||||
if (/^(rgb|RGB)/.test(rgb)) {
|
||||
let color = rgb.replace(/(?:\(|\)|rgb|GRB)*/g, "").split(',')
|
||||
let strHex = '#'
|
||||
for (let i = 0; i < color.length; i++) {
|
||||
let hex = Number(color[i]).toString(16)
|
||||
// 保证每个值否是两位数
|
||||
hex = String(hex).length === 1 ? 0 + '' + hex: hex
|
||||
if (hex === '0') {
|
||||
hex += hex
|
||||
}
|
||||
strHex += hex
|
||||
}
|
||||
if (strHex.length !== 7) {
|
||||
strHex = rgb
|
||||
}
|
||||
return strHex
|
||||
} else if (reg.test(rgb)) {
|
||||
let num = rgb.replace(/#/, '').split('')
|
||||
if (num.length === 6) {
|
||||
return rgb
|
||||
} else if (num.length === 3) {
|
||||
let numHex = '#'
|
||||
for (let i = 0; i < num.length; i++) {
|
||||
numHex += (num[i] + num[i])
|
||||
}
|
||||
return numHex
|
||||
}
|
||||
} else {
|
||||
return rgb
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将传入的颜色值转换为rgba字符串
|
||||
*
|
||||
* @param {String} color 颜色
|
||||
* @param {Number} alpha 透明度
|
||||
*/
|
||||
function colorToRGBA(color, alpha = 0.3) {
|
||||
color = rgbToHex(color)
|
||||
// 十六进制颜色值的正则表达式
|
||||
let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
||||
|
||||
color = color.toLowerCase()
|
||||
if (color && reg.test(color)) {
|
||||
// #000 => #000000
|
||||
if (color.length === 4) {
|
||||
let colorNew = '#'
|
||||
for (let i = 1; i < 4; i++) {
|
||||
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
||||
}
|
||||
color = colorNew
|
||||
}
|
||||
// 处理六位的颜色值
|
||||
let colorChange = []
|
||||
for (let i = 1; i < 7; i += 2) {
|
||||
colorChange.push(parseInt("0x" + color.slice(i, i + 2)))
|
||||
}
|
||||
return `rgba(${colorChange[0]}, ${colorChange[1]}, ${colorChange[2]}, ${alpha})`
|
||||
} else {
|
||||
return color
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
COOL_BG_COLOR_COUNT: COOL_BG_COLOR_COUNT,
|
||||
getTuniaoColorList,
|
||||
getRandomColorClass,
|
||||
getRandomCoolBgClass,
|
||||
getBackgroundColorInternalClass,
|
||||
getBackgroundColorStyle,
|
||||
getFontColorInternalClass,
|
||||
getFontColorStyle,
|
||||
colorGradient,
|
||||
hexToRGB,
|
||||
rgbToHex,
|
||||
colorToRGBA
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* 弹出系统内置的toast
|
||||
*/
|
||||
function toast(title, mask = false, cb = null, icon = 'none', duration = 1500) {
|
||||
uni.showToast({
|
||||
title: title,
|
||||
icon: icon,
|
||||
mask: mask,
|
||||
duration: duration,
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
cb && cb()
|
||||
}, duration)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出内置的加载框
|
||||
*/
|
||||
function loading(title) {
|
||||
uni.showLoading({
|
||||
title: title,
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出系统内置的modal
|
||||
*/
|
||||
function modal(title,
|
||||
content,
|
||||
confirmCb,
|
||||
showCancel = false,
|
||||
cancelCb = null,
|
||||
confirmText = "确定",
|
||||
cancelText = "取消") {
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
showCancel: showCancel,
|
||||
cancelText: cancelText,
|
||||
confirmText: confirmText,
|
||||
success: (res) => {
|
||||
if (res.cancel) {
|
||||
cancelCb && cancelCb()
|
||||
} else if (res.confirm) {
|
||||
confirmCb && confirmCb()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭系统内置toast
|
||||
*/
|
||||
function closeToast() {
|
||||
uni.hideToast()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭系统内置的加载框
|
||||
*/
|
||||
function closeLoading() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
|
||||
export default {
|
||||
toast,
|
||||
loading,
|
||||
modal,
|
||||
closeToast,
|
||||
closeLoading
|
||||
}
|
||||
@@ -26,19 +26,19 @@ module.exports = {
|
||||
},
|
||||
computed: {
|
||||
backgroundColorStyle() {
|
||||
return this.$t.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorStyle(this.backgroundColor)
|
||||
},
|
||||
backgroundColorClass() {
|
||||
return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor)
|
||||
},
|
||||
fontColorStyle() {
|
||||
return this.$t.color.getFontColorStyle(this.fontColor)
|
||||
return this.$tn.color.getFontColorStyle(this.fontColor)
|
||||
},
|
||||
fontColorClass() {
|
||||
return this.$t.color.getFontColorInternalClass(this.fontColor)
|
||||
return this.$tn.color.getFontColorInternalClass(this.fontColor)
|
||||
},
|
||||
fontSizeStyle() {
|
||||
return this.$t.string.getLengthUnitValue(this.fontSize, this.fontUnit)
|
||||
return this.$tn.string.getLengthUnitValue(this.fontSize, this.fontUnit)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -4,12 +4,12 @@ module.exports = {
|
||||
},
|
||||
onLoad() {
|
||||
// getRect挂载再$t上,用为这个方法需要使用in(this),所以无法把它独立层一个单独的文件导出
|
||||
this.$t.getRect = this._tGetRect
|
||||
this.$tn.getRect = this._tGetRect
|
||||
},
|
||||
beforeDestory() {
|
||||
// 判断当前页面是否存在parent和children
|
||||
// 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
|
||||
if (this.parent && uni.$t.test.array(this.parent.children)) {
|
||||
if (this.parent && uni.$tn.test.array(this.parent.children)) {
|
||||
// 组件销毁时,移除子组件在父组件children数组中的实例
|
||||
const childrenList = this.parent.children
|
||||
childrenList.map((child, index) => {
|
||||
@@ -50,7 +50,7 @@ module.exports = {
|
||||
// 通过获取父组件实例
|
||||
// 将父组件this中对应的参数,赋值给本组件的parentData对象中对应的属性
|
||||
// 头条小程序不支持通过this.parent.xxx去监听父组件参数的变化,所以需要本方法进行实现
|
||||
this.parent = this.$t.$parent.call(this, parentName)
|
||||
this.parent = this.$tn.$parent.call(this, parentName)
|
||||
if (this.parent) {
|
||||
// 遍历parentData中的属性,将parent中同名的属性赋值给parentData
|
||||
Object.keys(this.parentData).map(key => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
onLoad() {
|
||||
// 设置默认的转发参数
|
||||
this.$t.mpShare = {
|
||||
this.$tn.mpShare = {
|
||||
// 分享的标题,默认为小程序名称
|
||||
title: '',
|
||||
// 分享的路径,默认为当前页面
|
||||
@@ -11,19 +11,19 @@ module.exports = {
|
||||
// 当前页面是否可以分享
|
||||
share: true
|
||||
}
|
||||
if (!this.$t.mpShare.share) {
|
||||
if (!this.$tn.mpShare.share) {
|
||||
uni.hideShareMenu()
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return this.$t.mpShare
|
||||
return this.$tn.mpShare
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.$t.mpShare.title,
|
||||
query: this.$t.mpShare.path.substring(this.$t.mpShare.path.indexOf('?') + 1, this.$t.mpShare.path.length),
|
||||
imageUrl: this.$t.mpShare.imageUrl
|
||||
title: this.$tn.mpShare.title,
|
||||
query: this.$tn.mpShare.path.substring(this.$tn.mpShare.path.indexOf('?') + 1, this.$tn.mpShare.path.length),
|
||||
imageUrl: this.$tn.mpShare.imageUrl
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
Reference in New Issue
Block a user