Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
9151b16f
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9151b16f
编写于
3月 31, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add rpx2px
上级
5e7465a9
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
278 addition
and
75 deletion
+278
-75
packages/global.d.ts
packages/global.d.ts
+1
-0
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+12
-0
packages/uni-api/src/service/base/upx2px.ts
packages/uni-api/src/service/base/upx2px.ts
+2
-1
packages/uni-h5-vue/dist/vue.runtime.esm.js
packages/uni-h5-vue/dist/vue.runtime.esm.js
+15
-2
packages/uni-h5-vue/lib/vue.runtime.esm.js
packages/uni-h5-vue/lib/vue.runtime.esm.js
+15
-2
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+47
-24
packages/uni-h5/src/framework/plugin/page.ts
packages/uni-h5/src/framework/plugin/page.ts
+1
-1
packages/uni-h5/src/platform/getBaseSystemInfo.ts
packages/uni-h5/src/platform/getBaseSystemInfo.ts
+53
-0
packages/uni-h5/src/platform/index.ts
packages/uni-h5/src/platform/index.ts
+1
-0
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
+26
-35
packages/uni-mp-alipay/build.json
packages/uni-mp-alipay/build.json
+8
-0
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+5
-1
packages/uni-mp-alipay/src/platform/index.ts
packages/uni-mp-alipay/src/platform/index.ts
+3
-0
packages/uni-mp-baidu/build.json
packages/uni-mp-baidu/build.json
+8
-0
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+5
-1
packages/uni-mp-baidu/src/platform/index.ts
packages/uni-mp-baidu/src/platform/index.ts
+3
-0
packages/uni-mp-qq/build.json
packages/uni-mp-qq/build.json
+8
-0
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+5
-1
packages/uni-mp-qq/src/platform/index.ts
packages/uni-mp-qq/src/platform/index.ts
+3
-0
packages/uni-mp-toutiao/build.json
packages/uni-mp-toutiao/build.json
+8
-0
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+5
-1
packages/uni-mp-toutiao/src/platform/index.ts
packages/uni-mp-toutiao/src/platform/index.ts
+3
-0
packages/uni-mp-weixin/build.json
packages/uni-mp-weixin/build.json
+8
-0
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+5
-1
packages/uni-mp-weixin/src/platform/index.ts
packages/uni-mp-weixin/src/platform/index.ts
+3
-0
packages/uni-quickapp-webview/build.json
packages/uni-quickapp-webview/build.json
+8
-0
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+5
-1
packages/uni-quickapp-webview/src/platform/index.ts
packages/uni-quickapp-webview/src/platform/index.ts
+3
-0
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
+1
-1
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
...s/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
+8
-3
未找到文件。
packages/global.d.ts
浏览文件 @
9151b16f
declare
var
tt
:
any
declare
var
qa
:
any
declare
var
swan
:
any
declare
var
qq
:
any
declare
var
__PLATFORM__
:
UniApp
.
PLATFORM
declare
var
__PLATFORM_PREFIX__
:
'
wx
'
|
'
qq
'
|
'
my
'
|
'
swan
'
|
'
tt
'
|
'
qa
'
declare
var
__GLOBAL__
:
Record
<
string
,
any
>
...
...
packages/shims-uni-app.d.ts
浏览文件 @
9151b16f
declare
namespace
Page
{
interface
PageInstance
{
$page
:
{
id
:
number
path
:
string
route
:
string
fullPath
:
string
options
:
Record
<
string
,
any
>
meta
:
UniApp
.
PageRouteMeta
}
}
}
declare
namespace
UniApp
{
type
ClassObj
=
Record
<
string
,
boolean
>
type
StyleObj
=
Record
<
string
,
any
>
...
...
packages/uni-api/src/service/base/upx2px.ts
浏览文件 @
9151b16f
import
{
getBaseSystemInfo
}
from
'
@dcloudio/uni-platform
'
import
{
createSyncApi
}
from
'
../../helpers/api
'
import
{
Upx2pxProtocol
}
from
'
../../protocols/base/upx2px
'
...
...
@@ -8,7 +9,7 @@ let deviceWidth = 0
let
deviceDPR
=
0
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
__GLOBAL__
.
getSystemInfoSync
()
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
()
deviceWidth
=
windowWidth
as
number
deviceDPR
=
pixelRatio
as
number
isIOS
=
platform
===
'
ios
'
...
...
packages/uni-h5-vue/dist/vue.runtime.esm.js
浏览文件 @
9151b16f
...
...
@@ -8084,7 +8084,7 @@ function patchStyle(el, prev, next) {
else
if
(
isString
(
next
))
{
if
(
prev
!==
next
)
{
const
current
=
style
.
display
;
style
.
cssText
=
n
ext
;
style
.
cssText
=
n
ormalizeRpx
(
next
)
;
// indicates that the `display` of the element is controlled by `v-show`,
// so we always keep the current `display` value regardless of the `style` value,
// thus handing over control to `v-show`.
...
...
@@ -8112,6 +8112,7 @@ function setStyle(style, name, val) {
val
.
forEach
(
v
=>
setStyle
(
style
,
name
,
v
));
}
else
{
val
=
normalizeRpx
(
val
);
if
(
name
.
startsWith
(
'
--
'
))
{
// custom property definition
style
.
setProperty
(
name
,
val
);
...
...
@@ -8147,7 +8148,19 @@ function autoPrefix(style, rawName) {
}
}
return
rawName
;
}
}
// fixed by xxxxxx
// upx,rpx
const
rpxRE
=
/
\b([
+-
]?\d
+
(\.\d
+
)?)[
r|u
]
px
\b
/g
;
const
normalizeRpx
=
(
val
)
=>
{
if
(
isString
(
val
))
{
return
val
.
replace
(
rpxRE
,
(
a
,
b
)
=>
{
// @ts-ignore
return
rpx2px
(
b
)
+
'
px
'
;
});
}
return
val
;
};
const
xlinkNS
=
'
http://www.w3.org/1999/xlink
'
;
function
patchAttr
(
el
,
key
,
value
,
isSVG
)
{
...
...
packages/uni-h5-vue/lib/vue.runtime.esm.js
浏览文件 @
9151b16f
...
...
@@ -8084,7 +8084,7 @@ function patchStyle(el, prev, next) {
else
if
(
isString
(
next
))
{
if
(
prev
!==
next
)
{
const
current
=
style
.
display
;
style
.
cssText
=
n
ext
;
style
.
cssText
=
n
ormalizeRpx
(
next
)
;
// indicates that the `display` of the element is controlled by `v-show`,
// so we always keep the current `display` value regardless of the `style` value,
// thus handing over control to `v-show`.
...
...
@@ -8112,6 +8112,7 @@ function setStyle(style, name, val) {
val
.
forEach
(
v
=>
setStyle
(
style
,
name
,
v
));
}
else
{
val
=
normalizeRpx
(
val
);
if
(
name
.
startsWith
(
'
--
'
))
{
// custom property definition
style
.
setProperty
(
name
,
val
);
...
...
@@ -8147,7 +8148,19 @@ function autoPrefix(style, rawName) {
}
}
return
rawName
;
}
}
// fixed by xxxxxx
// upx,rpx
const
rpxRE
=
/
\b([
+-
]?\d
+
(\.\d
+
)?)[
r|u
]
px
\b
/g
;
const
normalizeRpx
=
(
val
)
=>
{
if
(
isString
(
val
))
{
return
val
.
replace
(
rpxRE
,
(
a
,
b
)
=>
{
// @ts-ignore
return
rpx2px
(
b
)
+
'
px
'
;
});
}
return
val
;
};
const
xlinkNS
=
'
http://www.w3.org/1999/xlink
'
;
function
patchAttr
(
el
,
key
,
value
,
isSVG
)
{
...
...
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
9151b16f
...
...
@@ -3339,6 +3339,33 @@ function getRealPath$1(filePath) {
}
return
filePath
;
}
const
ua
=
navigator
.
userAgent
;
const
isAndroid
=
/android/i
.
test
(
ua
);
const
isIOS$1
=
/iphone|ipad|ipod/i
.
test
(
ua
);
function
getScreenFix
()
{
return
/^Apple/
.
test
(
navigator
.
vendor
)
&&
typeof
window
.
orientation
===
"
number
"
;
}
function
isLandscape
(
screenFix
)
{
return
screenFix
&&
Math
.
abs
(
window
.
orientation
)
===
90
;
}
function
getScreenWidth
(
screenFix
,
landscape
)
{
return
screenFix
?
Math
[
landscape
?
"
max
"
:
"
min
"
](
screen
.
width
,
screen
.
height
)
:
screen
.
width
;
}
function
getScreenHeight
(
screenFix
,
landscape
)
{
return
screenFix
?
Math
[
landscape
?
"
min
"
:
"
max
"
](
screen
.
height
,
screen
.
width
)
:
screen
.
height
;
}
function
getWindowWidth
(
screenWidth
)
{
return
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
||
screenWidth
;
}
function
getBaseSystemInfo
()
{
const
screenFix
=
getScreenFix
();
const
windowWidth
=
getWindowWidth
(
getScreenWidth
(
screenFix
,
isLandscape
(
screenFix
)));
return
{
platform
:
isIOS$1
?
"
ios
"
:
"
other
"
,
pixelRatio
:
window
.
devicePixelRatio
,
windowWidth
};
}
var
index_vue_vue_type_style_index_0_lang$d
=
"
\n
uni-image {
\r\n
width: 320px;
\r\n
height: 240px;
\r\n
display: inline-block;
\r\n
overflow: hidden;
\r\n
position: relative;
\n
}
\n
uni-image[hidden] {
\r\n
display: none;
\n
}
\n
uni-image > div {
\r\n
width: 100%;
\r\n
height: 100%;
\n
}
\n
uni-image > img {
\r\n
-webkit-touch-callout: none;
\r\n
-webkit-user-select: none;
\r\n
-moz-user-select: none;
\r\n
display: block;
\r\n
position: absolute;
\r\n
top: 0;
\r\n
left: 0;
\r\n
width: 100%;
\r\n
height: 100%;
\r\n
opacity: 0;
\n
}
\n
uni-image > .uni-image-will-change {
\r\n
will-change: transform;
\n
}
\r\n
"
;
const
_sfc_main$j
=
{
name
:
"
Image
"
,
...
...
@@ -7736,14 +7763,14 @@ const Upx2pxProtocol = [
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
$1
=
false
;
let
isIOS
=
false
;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
:
pixelRatio2
,
windowWidth
}
=
__GLOBAL__
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
:
pixelRatio2
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio2
;
isIOS
$1
=
platform
===
"
ios
"
;
isIOS
=
platform
===
"
ios
"
;
}
const
upx2px
=
/* @__PURE__ */
createSyncApi
(
"
upx2px
"
,
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
...
...
@@ -7759,7 +7786,7 @@ const upx2px = /* @__PURE__ */ createSyncApi("upx2px", (number, newDeviceWidth)
}
result
=
Math
.
floor
(
result
+
EPS
);
if
(
result
===
0
)
{
if
(
deviceDPR
===
1
||
!
isIOS
$1
)
{
if
(
deviceDPR
===
1
||
!
isIOS
)
{
result
=
1
;
}
else
{
result
=
0.5
;
...
...
@@ -7984,24 +8011,20 @@ const canIUse = /* @__PURE__ */ createSyncApi("canIUse", (schema) => {
const
makePhoneCall
=
/* @__PURE__ */
createAsyncApi
(
"
makePhoneCall
"
,
(
option
)
=>
{
window
.
location
.
href
=
`tel:
${
option
.
phoneNumber
}
`
;
},
MakePhoneCallProtocol
);
const
ua
=
navigator
.
userAgent
;
const
isAndroid
=
/android/i
.
test
(
ua
);
const
isIOS
=
/iphone|ipad|ipod/i
.
test
(
ua
);
const
getSystemInfoSync
=
/* @__PURE__ */
createSyncApi
(
"
getSystemInfoSync
"
,
()
=>
{
var
screen
=
window
.
screen
;
var
pixelRatio2
=
window
.
devicePixelRatio
;
const
screenFix
=
/^Apple/
.
test
(
navigator
.
vendor
)
&&
typeof
window
.
orientation
===
"
number
"
;
const
landscape
=
screenFix
&&
Math
.
abs
(
window
.
orientation
)
===
90
;
var
screenWidth
=
screenFix
?
Math
[
landscape
?
"
max
"
:
"
min
"
](
screen
.
width
,
screen
.
height
)
:
screen
.
width
;
var
screenHeight
=
screenFix
?
Math
[
landscape
?
"
min
"
:
"
max
"
](
screen
.
height
,
screen
.
width
)
:
screen
.
height
;
var
windowWidth
=
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
||
screenWidth
;
var
windowHeight
=
window
.
innerHeight
;
var
language
=
navigator
.
language
;
var
statusBarHeight
=
out
.
top
;
var
osname
;
var
osversion
;
var
model
;
if
(
isIOS
)
{
const
pixelRatio2
=
window
.
devicePixelRatio
;
const
screenFix
=
getScreenFix
();
const
landscape
=
isLandscape
(
screenFix
);
const
screenWidth
=
getScreenWidth
(
screenFix
,
landscape
);
const
screenHeight
=
getScreenHeight
(
screenFix
,
landscape
);
const
windowWidth
=
getWindowWidth
(
screenWidth
);
let
windowHeight
=
window
.
innerHeight
;
const
language
=
navigator
.
language
;
const
statusBarHeight
=
out
.
top
;
let
osname
;
let
osversion
;
let
model
;
if
(
isIOS$1
)
{
osname
=
"
iOS
"
;
const
osversionFind
=
ua
.
match
(
/OS
\s([\w
_
]
+
)\s
like/
);
if
(
osversionFind
)
{
...
...
@@ -8053,9 +8076,9 @@ const getSystemInfoSync = /* @__PURE__ */ createSyncApi("getSystemInfoSync", ()
osname
=
"
Other
"
;
osversion
=
"
0
"
;
}
var
system
=
`
${
osname
}
${
osversion
}
`
;
var
platform
=
osname
.
toLocaleLowerCase
();
var
safeArea
=
{
const
system
=
`
${
osname
}
${
osversion
}
`
;
const
platform
=
osname
.
toLocaleLowerCase
();
const
safeArea
=
{
left
:
out
.
left
,
right
:
windowWidth
-
out
.
right
,
top
:
out
.
top
,
...
...
packages/uni-h5/src/framework/plugin/page.ts
浏览文件 @
9151b16f
...
...
@@ -49,7 +49,7 @@ function initPublicPage(route: RouteLocationNormalizedLoaded) {
}
export
function
initPage
(
vm
:
ComponentPublicInstance
)
{
currentPages
.
push
(
vm
as
Page
.
PageInstance
)
currentPages
.
push
(
(
vm
as
unknown
)
as
Page
.
PageInstance
)
const
route
=
vm
.
$route
;(
vm
as
any
).
$page
=
initPublicPage
(
route
)
}
...
...
packages/uni-h5/src/platform/getBaseSystemInfo.ts
0 → 100644
浏览文件 @
9151b16f
export
const
ua
=
navigator
.
userAgent
export
const
isAndroid
=
/android/i
.
test
(
ua
)
export
const
isIOS
=
/iphone|ipad|ipod/i
.
test
(
ua
)
export
function
getScreenFix
()
{
return
(
/^Apple/
.
test
(
navigator
.
vendor
)
&&
typeof
window
.
orientation
===
'
number
'
)
}
export
function
isLandscape
(
screenFix
:
boolean
)
{
return
screenFix
&&
Math
.
abs
(
window
.
orientation
as
number
)
===
90
}
export
function
getScreenWidth
(
screenFix
:
boolean
,
landscape
:
boolean
)
{
return
screenFix
?
Math
[
landscape
?
'
max
'
:
'
min
'
](
screen
.
width
,
screen
.
height
)
:
screen
.
width
}
export
function
getScreenHeight
(
screenFix
:
boolean
,
landscape
:
boolean
)
{
return
screenFix
?
Math
[
landscape
?
'
min
'
:
'
max
'
](
screen
.
height
,
screen
.
width
)
:
screen
.
height
}
export
function
getWindowWidth
(
screenWidth
:
number
)
{
return
(
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
||
screenWidth
)
}
/**
* 简易版systemInfo,主要为upx2px服务
* @returns
*/
export
function
getBaseSystemInfo
()
{
const
screenFix
=
getScreenFix
()
const
windowWidth
=
getWindowWidth
(
getScreenWidth
(
screenFix
,
isLandscape
(
screenFix
))
)
return
{
platform
:
isIOS
?
'
ios
'
:
'
other
'
,
pixelRatio
:
window
.
devicePixelRatio
,
windowWidth
,
}
}
packages/uni-h5/src/platform/index.ts
浏览文件 @
9151b16f
export
*
from
'
./getRealPath
'
export
{
getBaseSystemInfo
}
from
'
./getBaseSystemInfo
'
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
浏览文件 @
9151b16f
...
...
@@ -4,45 +4,36 @@ import { createSyncApi } from '@dcloudio/uni-api'
import
{
getWindowOffset
}
from
'
@dcloudio/uni-core
'
const
ua
=
navigator
.
userAgent
/**
* 是否安卓设备
*/
const
isAndroid
=
/android/i
.
test
(
ua
)
/**
* 是否iOS设备
*/
const
isIOS
=
/iphone|ipad|ipod/i
.
test
(
ua
)
import
{
ua
,
isIOS
,
isAndroid
,
isLandscape
,
getScreenFix
,
getScreenWidth
,
getWindowWidth
,
getScreenHeight
,
}
from
'
../../../platform/getBaseSystemInfo
'
/**
* 获取系统信息-同步
*/
export
const
getSystemInfoSync
=
createSyncApi
<
typeof
uni
.
getSystemInfoSync
>
(
'
getSystemInfoSync
'
,
()
=>
{
var
screen
=
window
.
screen
var
pixelRatio
=
window
.
devicePixelRatio
const
pixelRatio
=
window
.
devicePixelRatio
// 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正
const
screenFix
=
/^Apple/
.
test
(
navigator
.
vendor
)
&&
typeof
window
.
orientation
===
'
number
'
const
landscape
=
screenFix
&&
Math
.
abs
(
window
.
orientation
as
number
)
===
90
var
screenWidth
=
screenFix
?
Math
[
landscape
?
'
max
'
:
'
min
'
](
screen
.
width
,
screen
.
height
)
:
screen
.
width
var
screenHeight
=
screenFix
?
Math
[
landscape
?
'
min
'
:
'
max
'
](
screen
.
height
,
screen
.
width
)
:
screen
.
height
var
windowWidth
=
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
||
screenWidth
var
windowHeight
=
window
.
innerHeight
var
language
=
navigator
.
language
var
statusBarHeight
=
safeAreaInsets
.
top
var
osname
var
osversion
var
model
const
screenFix
=
getScreenFix
()
const
landscape
=
isLandscape
(
screenFix
)
const
screenWidth
=
getScreenWidth
(
screenFix
,
landscape
)
const
screenHeight
=
getScreenHeight
(
screenFix
,
landscape
)
const
windowWidth
=
getWindowWidth
(
screenWidth
)
let
windowHeight
=
window
.
innerHeight
const
language
=
navigator
.
language
const
statusBarHeight
=
safeAreaInsets
.
top
let
osname
let
osversion
let
model
if
(
isIOS
)
{
osname
=
'
iOS
'
...
...
@@ -99,9 +90,9 @@ export const getSystemInfoSync = createSyncApi<typeof uni.getSystemInfoSync>(
osversion
=
'
0
'
}
var
system
=
`
${
osname
}
${
osversion
}
`
var
platform
=
osname
.
toLocaleLowerCase
()
var
safeArea
=
{
const
system
=
`
${
osname
}
${
osversion
}
`
const
platform
=
osname
.
toLocaleLowerCase
()
const
safeArea
=
{
left
:
safeAreaInsets
.
left
,
right
:
windowWidth
-
safeAreaInsets
.
right
,
top
:
safeAreaInsets
.
top
,
...
...
packages/uni-mp-alipay/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-mp-alipay/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"my"
,
"__PLATFORM__"
:
"
\"
mp-alipay
\"
"
,
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
my
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
my
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-mp-alipay/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
my
.
getSystemInfoSync
()
}
packages/uni-mp-baidu/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-mp-baidu/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"swan"
,
"__PLATFORM__"
:
"
\"
mp-baidu
\"
"
,
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
swan
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
swan
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-mp-baidu/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
swan
.
getSystemInfoSync
()
}
packages/uni-mp-qq/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-mp-qq/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"qq"
,
"__PLATFORM__"
:
"
\"
mp-qq
\"
"
,
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
qq
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
qq
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-mp-qq/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
qq
.
getSystemInfoSync
()
}
packages/uni-mp-toutiao/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-mp-toutiao/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"tt"
,
"__PLATFORM__"
:
"
\"
mp-toutiao
\"
"
,
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
tt
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
tt
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-mp-toutiao/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
tt
.
getSystemInfoSync
()
}
packages/uni-mp-weixin/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-mp-weixin/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"wx"
,
"__PLATFORM__"
:
"
\"
mp-weixin
\"
"
,
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
wx
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
wx
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-mp-weixin/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
wx
.
getSystemInfoSync
()
}
packages/uni-quickapp-webview/build.json
浏览文件 @
9151b16f
...
...
@@ -3,6 +3,14 @@
"src/runtime/index.ts"
:
"dist/uni.mp.esm.js"
,
"src/api/index.ts"
:
"dist/uni.api.esm.js"
},
"alias"
:
{
"entries"
:
[
{
"find"
:
"@dcloudio/uni-platform"
,
"replacement"
:
"packages/uni-quickapp-webview/src/platform/index.ts"
}
]
},
"replacements"
:
{
"__GLOBAL__"
:
"qa"
,
"__PLATFORM__"
:
"
\"
quickapp-webview
\"
"
,
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
9151b16f
...
...
@@ -301,6 +301,10 @@ function createApi(type, name, fn, protocol, options) {
}
}
function
getBaseSystemInfo
()
{
return
qa
.
getSystemInfoSync
()
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
...
...
@@ -315,7 +319,7 @@ let isIOS = false;
let
deviceWidth
=
0
;
let
deviceDPR
=
0
;
function
checkDeviceWidth
()
{
const
{
platform
,
pixelRatio
,
windowWidth
}
=
qa
.
getSystemInfoSync
();
const
{
platform
,
pixelRatio
,
windowWidth
}
=
getBaseSystemInfo
();
deviceWidth
=
windowWidth
;
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
...
...
packages/uni-quickapp-webview/src/platform/index.ts
0 → 100644
浏览文件 @
9151b16f
export
function
getBaseSystemInfo
()
{
return
qa
.
getSystemInfoSync
()
}
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
浏览文件 @
9151b16f
...
...
@@ -51,11 +51,11 @@ const uniEasycomPluginOptions: Partial<UniPluginFilterOptions> = {
const
uniInjectPluginOptions
:
Partial
<
InjectOptions
>
=
{
exclude
:
[...
COMMON_EXCLUDE
],
'
__GLOBAL__.
'
:
'
@dcloudio/uni-h5
'
,
'
uni.
'
:
'
@dcloudio/uni-h5
'
,
getApp
:
[
'
@dcloudio/uni-h5
'
,
'
getApp
'
],
getCurrentPages
:
[
'
@dcloudio/uni-h5
'
,
'
getCurrentPages
'
],
UniServiceJSBridge
:
[
'
@dcloudio/uni-h5
'
,
'
UniServiceJSBridge
'
],
UniViewJSBridge
:
[
'
@dcloudio/uni-h5
'
,
'
UniViewJSBridge
'
],
}
export
function
resolvePlugins
(
...
...
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
浏览文件 @
9151b16f
...
...
@@ -27,7 +27,8 @@ export function uniPagesJsonPlugin(
if
(
id
.
endsWith
(
PAGES_JSON_JS
))
{
return
{
code
:
(
options
.
command
===
'
serve
'
?
registerGlobalCode
:
''
)
+
registerGlobalCode
+
(
options
.
command
===
'
serve
'
?
registerDevServerGlobalCode
:
''
)
+
parsePagesJson
(
code
,
config
,
options
),
map
:
{
mappings
:
''
},
}
...
...
@@ -79,10 +80,14 @@ const hmrCode = `if(import.meta.hot){
})
}`
const
registerGlobalCode
=
`import {uni,getCurrentPages,getApp,UniServiceJSBridge,UniViewJSBridge} from '@dcloudio/uni-h5'
const
registerGlobalCode
=
`import {upx2px} from '@dcloudio/uni-h5'
window.rpx2px = upx2px
`
const
registerDevServerGlobalCode
=
`import {uni,getCurrentPages,getApp,UniServiceJSBridge,UniViewJSBridge} from '@dcloudio/uni-h5'
window.getApp = getApp
window.getCurrentPages = getCurrentPages
window.uni =
window.__GLOBAL__ =
uni
window.uni = uni
window.UniViewJSBridge = UniViewJSBridge
window.UniServiceJSBridge = UniServiceJSBridge
`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录