修改$t为$tn

修改部分函数api的名称
This commit is contained in:
jaylen
2022-11-27 16:58:51 +08:00
parent 72d0c5872a
commit fa70ad608a
92 changed files with 1475 additions and 1461 deletions

View File

@@ -48,9 +48,9 @@
<view class="tn-padding-bottom-lg"></view>
</view>
</view>
</template>
</view>
</template>
<script>
import demoTitle from '@/libs/components/demo-title.vue'
export default {
@@ -68,29 +68,29 @@
methods: {
// 获取随机背景颜色
getRandomBgColor() {
this.randomBgColorClass = this.$t.color.getRandomColorClass()
this.randomBgColorClass = this.$tn.color.getRandomColorClass()
},
// 获取随机颜色
getRandomColor() {
this.randomColorClass = this.$t.color.getRandomColorClass('color')
this.randomColorClass = this.$tn.color.getRandomColorClass('color')
},
// 获取随机酷炫背景颜色
getRandomCoolColor() {
this.randomCoolBgColorClass = this.$t.color.getRandomCoolBgClass()
this.randomCoolBgColorClass = this.$tn.color.getRandomCoolBgClass()
},
// 将hex与rgb互转
convertToRGBOrHex() {
if (this.rgbFlag) {
this.hexRGBValue = this.$t.color.rgbToHex(this.hexRGBValue)
this.hexRGBValue = this.$tn.color.rgbToHex(this.hexRGBValue)
} else {
this.hexRGBValue = this.$t.color.hexToRGB(this.hexRGBValue)
this.hexRGBValue = this.$tn.color.hexToRGB(this.hexRGBValue)
}
this.rgbFlag = !this.rgbFlag
}
}
}
</script>
}
</script>
<style lang="scss" scoped>
.basic-utils__color {
background-color: $tn-bg-gray-color;
@@ -101,5 +101,5 @@
width: auto;
padding: 10rpx 20rpx;
}
}
</style>
}
</style>

View File

@@ -91,9 +91,9 @@
<view class="tn-padding-bottom-lg"></view>
</view>
</view>
</template>
</view>
</template>
<script>
import demoTitle from '@/libs/components/demo-title.vue'
export default {
@@ -107,70 +107,70 @@
methods: {
// 弹出toast
openToast_1() {
this.$t.message.toast('弹出toast')
this.$tn.message.toast('弹出toast')
},
openToast_2() {
this.$t.message.toast('弹出toast icon', false, null, 'success')
this.$tn.message.toast('弹出toast icon', false, null, 'success')
},
openToast_3() {
this.$t.message.toast('弹出toast mask', true)
this.$tn.message.toast('弹出toast mask', true)
},
openToast_4() {
this.$t.message.toast('弹出toast duration', false, null, 'none', 3000)
this.$tn.message.toast('弹出toast duration', false, null, 'none', 3000)
},
openToast_5() {
this.$t.message.toast('弹出toast cb', true, () => {
this.$tn.message.toast('弹出toast cb', true, () => {
setTimeout(() => {
this.$t.message.toast('执行完毕后弹出', true, null, 'success')
this.$tn.message.toast('执行完毕后弹出', true, null, 'success')
}, 500)
})
},
// 关闭Toast
closeToast() {
this.$t.message.closeToast()
this.$tn.message.closeToast()
},
// 弹出loading
openLoading() {
this.$t.message.loading('弹出loading')
this.$tn.message.loading('弹出loading')
setTimeout(() => {
this.closeLoading()
}, 3000)
},
// 关闭loading
closeLoading() {
this.$t.message.closeLoading()
this.$tn.message.closeLoading()
},
// 弹出modal
openModal_1() {
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
this.$t.message.toast('点击了确认按钮')
this.$tn.message.modal("提示", "请进行登录后进行操作", () => {
this.$tn.message.toast('点击了确认按钮')
}, true, () => {
this.$t.message.toast('点击了取消按钮')
this.$tn.message.toast('点击了取消按钮')
})
},
openModal_2() {
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
this.$t.message.toast('点击了确认按钮')
this.$tn.message.modal("提示", "请进行登录后进行操作", () => {
this.$tn.message.toast('点击了确认按钮')
}, false, null)
},
openModal_3() {
this.$t.message.modal("提示", "请进行登录后进行操作", () => {
this.$t.message.toast('点击了跳转按钮')
this.$tn.message.modal("提示", "请进行登录后进行操作", () => {
this.$tn.message.toast('点击了跳转按钮')
}, true, () => {
this.$t.message.toast('点击了拒绝按钮')
this.$tn.message.toast('点击了拒绝按钮')
}, "跳转登录", "拒绝登录")
}
}
}
</script>
}
</script>
<style lang="scss" scoped>
.basic-utils__message {
background-color: $tn-bg-gray-color;
min-height: 100vh;
}
</style>
}
</style>

View File

@@ -12,25 +12,25 @@
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过2位自动添加'+'</view>
<view>{{ $t.number.formatNumberString(56) }}</view>
<view>{{ $tn.number.formatNumberString(56) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过2位自动添加'+'</view>
<view>{{ $t.number.formatNumberString(100) }}</view>
<view>{{ $tn.number.formatNumberString(100) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过3位自动添加'+'</view>
<view>{{ $t.number.formatNumberString(899, 3) }}</view>
<view>{{ $tn.number.formatNumberString(899, 3) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过3位自动添加'+'</view>
<view>{{ $t.number.formatNumberString(1000, 3) }}</view>
<view>{{ $tn.number.formatNumberString(1000, 3) }}</view>
</view>
</tn-list-cell>
</tn-list-view>
@@ -41,19 +41,19 @@
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>只有一位时会往前面添加'0'</view>
<view>{{ $t.number.formatNumberAddZero(6) }}</view>
<view>{{ $tn.number.formatNumberAddZero(6) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过两位时不会往前面添加'0'</view>
<view>{{ $t.number.formatNumberAddZero(16) }}</view>
<view>{{ $tn.number.formatNumberAddZero(16) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>超过两位时不会往前面添加'0'</view>
<view>{{ $t.number.formatNumberAddZero(106) }}</view>
<view>{{ $tn.number.formatNumberAddZero(106) }}</view>
</view>
</tn-list-cell>
</tn-list-view>
@@ -64,37 +64,37 @@
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>不带单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(100) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(100) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>不带单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(100.88) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(100.88) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>带K单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(1000) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(1000) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>带K单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(1032.89) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(1032.89) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>带W单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(10000) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(10000) }}</view>
</view>
</tn-list-cell>
<tn-list-cell>
<view class="tn-flex tn-flex-col-center tn-flex-row-between">
<view>带W单位</view>
<view>{{ $t.number.formatNumberAddPriceUnit(10875.90) }}</view>
<view>{{ $tn.number.formatNumberAddPriceUnit(10875.90) }}</view>
</view>
</tn-list-cell>
</tn-list-view>
@@ -124,9 +124,9 @@
<view class="tn-padding-bottom-lg"></view>
</view>
</view>
</template>
</view>
</template>
<script>
import demoTitle from '@/libs/components/demo-title.vue'
export default {
@@ -141,19 +141,19 @@
methods: {
// 获取随机值
getRandomValue() {
this.randomValue = this.$t.number.random(0, 100.99)
this.randomValue = this.$tn.number.random(0, 100.99)
},
// 获取整数随机值
getIntRandomValue() {
this.intRandomValue = this.$t.number.randomInt(0, 100)
this.intRandomValue = this.$tn.number.randomInt(0, 100)
}
}
}
</script>
}
</script>
<style lang="scss" scoped>
.basic-utils__number {
background-color: $tn-bg-gray-color;
min-height: 100vh;
}
</style>
}
</style>

View File

@@ -49,9 +49,9 @@
<view class="tn-padding-bottom-lg"></view>
</view>
</view>
</template>
</view>
</template>
<script>
import demoTitle from '@/libs/components/demo-title.vue'
export default {
@@ -67,23 +67,23 @@
methods: {
// 处理去除空格
handlerTrim() {
this.trimValue = this.$t.string.trim(this.trimValue)
this.trimValue = this.$tn.string.trim(this.trimValue)
},
// 处理将大写字符串转换为指定的连接符连接的字符串
handlerHumpChar() {
this.humpCharValue = this.$t.string.humpConvertChar(this.humpCharValue, '_')
this.humpCharValue = this.$tn.string.humpConvertChar(this.humpCharValue, '_')
},
// 处理将指定的连接字符连接的字符串转换为大写的字符串
handlerCharHump() {
this.charHumpValue = this.$t.string.charConvertHump(this.charHumpValue, '_')
this.charHumpValue = this.$tn.string.charConvertHump(this.charHumpValue, '_')
}
}
}
</script>
}
</script>
<style lang="scss" scoped>
.basic-utils__string {
background-color: $tn-bg-gray-color;
min-height: 100vh;
}
</style>
}
</style>