diff --git a/src/App.vue b/src/App.vue index 32967bb..10b9e45 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,8 @@ + + \ No newline at end of file diff --git a/src/core/libs/utils.js b/src/core/libs/utils.js index c763718..9550eab 100644 --- a/src/core/libs/utils.js +++ b/src/core/libs/utils.js @@ -1,3 +1,5 @@ +import Vue from 'vue' + function time() { return parseInt(Math.round(new Date() / 1000)); }; @@ -142,7 +144,17 @@ function debounce(func, wait = 500, immediate = false) { } } -export { +function px2rpx(px) { + const { windowWidth } = uni.getStorageSync('system_config'); + return 750 * (px / windowWidth); +} + +function rpx2px(rpx) { + const { windowWidth } = uni.getStorageSync('system_config'); + return (rpx / 750) * windowWidth; +} + +export default { time, datetime, timeDifference, @@ -150,4 +162,6 @@ export { randomString, throttle, debounce, + px2rpx, + rpx2px, } diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue index aa3c93d..d29a69c 100644 --- a/src/pages/service/cate.vue +++ b/src/pages/service/cate.vue @@ -1,5 +1,5 @@