当前位置:网站首页>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);
},
}
边栏推荐
- 六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
- On Multus CNI
- el-table单选并隐藏全选框
- H5 audio tag custom style modification and adding playback control events
- QTreeView+自定义Model实现示例
- Hands on deep learning (43) -- machine translation and its data construction
- Matlab tips (25) competitive neural network and SOM neural network
- 2021-08-10 character pointer
- Exercise 9-4 finding books (20 points)
- 2. Data type
猜你喜欢
【Day2】 convolutional-neural-networks
智慧路灯杆水库区安全监测应用
C # use ffmpeg for audio transcoding
A little feeling
PHP student achievement management system, the database uses mysql, including source code and database SQL files, with the login management function of students and teachers
El Table Radio select and hide the select all box
Hands on deep learning (32) -- fully connected convolutional neural network FCN
法向量点云旋转
Fabric of kubernetes CNI plug-in
C语言指针经典面试题——第一弹
随机推荐
Hands on deep learning (34) -- sequence model
按键精灵跑商学习-商品数量、价格提醒、判断背包
Dynamic address book
QTreeView+自定义Model实现示例
Hands on deep learning (38) -- realize RNN from scratch
转载:等比数列的求和公式,及其推导过程
How can people not love the amazing design of XXL job
Hands on deep learning (35) -- text preprocessing (NLP)
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
C language pointer classic interview question - the first bullet
Lavel document reading notes -how to use @auth and @guest directives in lavel
Hands on deep learning (36) -- language model and data set
【OpenCV 例程200篇】218. 多行倾斜文字水印
MySQL case
Advanced technology management - how to design and follow up the performance of students at different levels
Batch distribution of SSH keys and batch execution of ansible
Pcl:: fromrosmsg alarm failed to find match for field 'intensity'
Legion is a network penetration tool
法向量点云旋转
Write a jison parser from scratch (3/10): a good beginning is half the success -- "politics" (Aristotle)