This commit is contained in:
mol
2024-06-06 09:54:41 +08:00
commit 68609e9414
2 changed files with 9 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
这个项目用来收集工作生活中的一些代码片段。

8
unit/rpx2px.js Normal file
View File

@ -0,0 +1,8 @@
import { isNumber } from 'lodash-es';
export const rpx2px = (rpx) => {
if (!isNumber(rpx)) return 0;
const screenWidth = uni.getSystemInfoSync().screenWidth;
const result = (screenWidth * rpx) / 750
return result;
}