当前位置:网站首页>If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display
If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display
2022-07-04 10:06:00 【gblfy】

List of articles
1. Public methods
methods: {
// Number conversion
graceNumber(number) {
if (number == 0) {
return "0";
} else if (number > 999 && number <= 9999) {
return (number / 1000).toFixed(1) + 'k';
} else if (number > 9999 && number <= 99999) {
return (number / 10000).toFixed(1) + 'w';
} else if (number > 99999) {
return "10w+";
}
return number;
},
}
2. Use
page
<template>
<view @click="openMask()"
style="margin-left: 50rpx;display: flex;flex-direction: column;justify-content: center;">
<text
style="color: #ffffff;font-size: 14px;font-weight: bold;align-self: center;">{
{
getGraceNumber(pageUserInfo.totalLikeMeCounts)}}</text>
<text style="color: #ffffff;font-size: 12px;font-weight: 300;align-self: center;"> Be praised </text>
</view>
</template>
Method area
methods: {
// Put more than 1000 or 10000 Digital adjustment of , such as 1.3k/6.8w
getGraceNumber(num) {
return getApp().graceNumber(num);
},
}
边栏推荐
- C # use ffmpeg for audio transcoding
- 今日睡眠质量记录78分
- Golang defer
- mmclassification 标注文件生成
- Hands on deep learning (35) -- text preprocessing (NLP)
- C # use smtpclient The sendasync method fails to send mail, and always returns canceled
- A little feeling
- Lavel document reading notes -how to use @auth and @guest directives in lavel
- Exercise 9-3 plane vector addition (15 points)
- Advanced technology management - how to design and follow up the performance of students at different levels
猜你喜欢

Sort out the power node, Mr. Wang he's SSM integration steps

C # use gdi+ to add text to the picture and make the text adaptive to the rectangular area

Dynamic memory management

Matlab tips (25) competitive neural network and SOM neural network

转载:等比数列的求和公式,及其推导过程

Hands on deep learning (44) -- seq2seq principle and Implementation

PHP personal album management system source code, realizes album classification and album grouping, as well as album image management. The database adopts Mysql to realize the login and registration f

Hands on deep learning (39) -- gating cycle unit Gru

基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 2

Summary of small program performance optimization practice
随机推荐
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
Exercise 7-3 store the numbers in the array in reverse order (20 points)
PHP personal album management system source code, realizes album classification and album grouping, as well as album image management. The database adopts Mysql to realize the login and registration f
今日睡眠质量记录78分
Devop basic command
C # use ffmpeg for audio transcoding
uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
Upgrading Xcode 12 caused Carthage to build cartfile containing only rxswift to fail
Write a mobile date selector component by yourself
Hands on deep learning (33) -- style transfer
C language pointer interview question - the second bullet
uniapp---初步使用websocket(长链接实现)
Lauchpad X | 模式
Write a jison parser (7/10) from scratch: the iterative development process of the parser generator 'parser generator'
【OpenCV 例程200篇】218. 多行倾斜文字水印
Hands on deep learning (36) -- language model and data set
lolcat
查看CSDN个人资源下载明细
el-table单选并隐藏全选框
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 2