reactor:getSystemInfoSync =》 getWindowInfo,解决 device

This commit is contained in:
YunaiV
2025-04-29 20:38:50 +08:00
parent 9582d5944e
commit c95f621144
7 changed files with 16 additions and 22 deletions
-8
View File
@@ -47,13 +47,6 @@ export function sleep(value = 30) {
export function os() {
return uni.getDeviceInfo().platform.toLowerCase();
}
/**
* @description 获取系统信息同步接口
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
*/
export function sys() {
return uni.getSystemInfoSync();
}
/**
* @description 取一个区间数
@@ -679,7 +672,6 @@ export default {
getPx,
sleep,
os,
sys,
random,
guid,
$parent,
+1 -1
View File
@@ -18,7 +18,7 @@ import apple from './provider/apple';
import share from './share';
import Pay from './pay';
const device = uni.getSystemInfoSync();
const device = uni.getWindowInfo();
const os = uni.getDeviceInfo().platform;
+6 -4
View File
@@ -5,7 +5,7 @@
</template>
<script>
import { deepMerge, addStyle, addUnit, sleep, guid, getPx, os, sys } from '@/sheep/helper';
import { deepMerge, addStyle, addUnit, guid, getPx, os } from '@/sheep/helper';
import sheep from '@/sheep';
/**
* sticky 吸顶
@@ -130,7 +130,8 @@
},
$uGetRect(selector, all) {
return new Promise((resolve) => {
uni.createSelectorQuery()
uni
.createSelectorQuery()
.in(this)
[all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
@@ -194,7 +195,7 @@
// #endif
// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
if (os() === 'android' && Number(sys().system) > 8) {
if (os() === 'android' && Number(uni.getDeviceInfo().system) > 8) {
this.cssSticky = true;
}
@@ -218,7 +219,8 @@
// 方法内进行判断,避免在其他平台生成无用代码
// #ifdef APP-VUE || MP-WEIXIN
return new Promise((resolve) => {
uni.createSelectorQuery()
uni
.createSelectorQuery()
.in(this)
.select('.u-sticky')
.fields({