Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
de71b7e4
U
uni-app
项目概览
DCloud
/
uni-app
6 个月 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
de71b7e4
编写于
9月 15, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): compiler
上级
21aec087
变更
21
展开全部
隐藏空白更改
内联
并排
Showing
21 changed file
with
462 addition
and
238 deletion
+462
-238
packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts
...ayground/uts/uni_modules/test-uniplugin/app-ios/index.uts
+14
-1
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift
...e/dist/app/uni_modules/test-uniplugin/app-ios/index.swift
+21
-3
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map
...st/app/uni_modules/test-uniplugin/app-ios/index.swift.map
+1
-1
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+1
-1
packages/uni-api/src/protocols/location/locationChange.ts
packages/uni-api/src/protocols/location/locationChange.ts
+6
-5
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+70
-3
packages/uni-app-plus/src/service/api/location/locationChange.ts
...s/uni-app-plus/src/service/api/location/locationChange.ts
+33
-31
packages/uni-cli-shared/src/json/app/manifest/tabBar.ts
packages/uni-cli-shared/src/json/app/manifest/tabBar.ts
+4
-2
packages/uni-components/dist/components.js
packages/uni-components/dist/components.js
+60
-40
packages/uni-h5-vite/src/plugins/manifestJson.ts
packages/uni-h5-vite/src/plugins/manifestJson.ts
+4
-4
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+15
-7
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+172
-97
packages/uni-h5/src/service/api/location/locationChange.ts
packages/uni-h5/src/service/api/location/locationChange.ts
+32
-32
packages/uni-uts-vite/src/plugins/v1.ts
packages/uni-uts-vite/src/plugins/v1.ts
+3
-3
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
+7
-3
packages/uni-uts-vite/src/utils/compiler/swift.ts
packages/uni-uts-vite/src/utils/compiler/swift.ts
+14
-3
packages/uni-uts-vite/src/utils/compiler/utils.ts
packages/uni-uts-vite/src/utils/compiler/utils.ts
+5
-2
packages/uts-darwin-arm64/uts.darwin-arm64.node
packages/uts-darwin-arm64/uts.darwin-arm64.node
+0
-0
packages/uts-darwin-x64/uts.darwin-x64.node
packages/uts-darwin-x64/uts.darwin-x64.node
+0
-0
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
+0
-0
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
+0
-0
未找到文件。
packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts
浏览文件 @
de71b7e4
import
{
UIDevice
}
from
'UIKit'
type
GetBatteryInfoOptions
=
{
name
:
string
pwd
:
number
success
?:
(
res
:
UTSJSONObject
)
=>
void
fail
?:
(
res
:
UTSJSONObject
)
=>
void
complete
?:
(
res
:
UTSJSONObject
)
=>
void
...
...
@@ -18,4 +20,15 @@ export default async function getBatteryInfo(options: GetBatteryInfoOptions) {
if
(
options
.
complete
!=
null
)
{
options
.
complete
!
(
res
)
}
}
\ No newline at end of file
}
export
function
test1
()
{
console
.
log
(
'test1'
)
}
class
Test1
{}
export
class
Test
{
constructor
()
{
new
Test1
()
}
}
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift
浏览文件 @
de71b7e4
import
DCUTSPlugin
;
import
UIKit
;
class
GetBatteryInfoOptions
:
UTSJSONObject
{
var
name
:
String
;
var
pwd
:
NSNumber
;
var
success
:
UTSCallback
?;
var
fail
:
UTSCallback
?;
var
complete
:
UTSCallback
?;
init
(
_
success
:
UTSCallback
,
_
fail
:
UTSCallback
,
_
complete
:
UTSCallback
){
init
(
_
name
:
String
,
_
pwd
:
NSNumber
,
_
success
:
UTSCallback
,
_
fail
:
UTSCallback
,
_
complete
:
UTSCallback
){
self
.
name
=
name
;
self
.
pwd
=
pwd
;
self
.
success
=
success
;
self
.
fail
=
fail
;
self
.
complete
=
complete
;
}
}
class
Test1
:
NSObject
{
}
class
Test
:
NSObject
{
init
(){
Test1
();
}
}
@objc
(
UTSSDKModulesTestUniPluginIndexSwift
)
@objcMembers
class
IndexSwift
:
NSObject
{
...
...
@@ -19,7 +30,14 @@ class IndexSwift : NSObject {
"level"
:
UIDevice
.
current
.
batteryLevel
*
100
,
"isCharging"
:
UIDevice
.
current
.
batteryState
==
UIDevice
.
BatteryState
.
charging
]
as
[
String
:
Any
];
if
(
options
.
success
!=
nil
)
options
.
success
!
(
res
);
if
(
options
.
complete
!=
nil
)
options
.
complete
!
(
res
);
if
(
options
.
success
!=
nil
)
{
options
.
success
!
(
res
);
}
if
(
options
.
complete
!=
nil
)
{
options
.
complete
!
(
res
);
}
}
static
func
test1
()
{
console
.
log
(
"test1"
,
" at uni_modules/test-uniplugin/app-ios/index.uts:26"
);
}
}
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map
浏览文件 @
de71b7e4
{
"version"
:
3
,
"sources"
:
[
"/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"
],
"sourcesContent"
:
[
"import { UIDevice } from 'UIKit'
\n\n
type GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void
\n
fail?: (res: UTSJSONObject) => void
\n
complete?: (res: UTSJSONObject) => void
\n
}
\n\n
export default async function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',
\n
level: UIDevice.current.batteryLevel * 100,
\n
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
\n
}
\n
if (options.success != null) {\n options.success!(res)
\n
}
\n
if (options.complete != null) {\n options.complete!(res)
\n
}
\n
}"
],
"names"
:
[],
"mappings"
:
";AAAA;AAE6B,MAAxB,qBAAqB;IACxB,IAAA,OAAO,EAAC,WAA8B,EAAA;IACtC,IAAA,IAAI,EAAC,WAA8B,EAAA;IACnC,IAAA,QAAQ,EAAC,WAA8B,EAAA;WAFvC,OAAO,EAAC,WAA8B,IACtC,IAAI,EAAC,WAA8B,IACnC,QAAQ,EAAC,WAA8B;;;;;CACxC;;;;sBAE6B,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;QAC3E,IAAM,GAAG,GAAG;YACV,CAAA,MAAM,GAAE,mBAAmB;YAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;YAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;0BAC5E;QACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI,EACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;QAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI,EAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;IAE1B"
}
\ No newline at end of file
{
"version"
:
3
,
"sources"
:
[
"/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"
],
"sourcesContent"
:
[
"import { UIDevice } from 'UIKit'
\n\n
type GetBatteryInfoOptions = {\n name: string
\n
pwd: number
\n
success?: (res: UTSJSONObject) => void
\n
fail?: (res: UTSJSONObject) => void
\n
complete?: (res: UTSJSONObject) => void
\n
}
\n\n
export default async function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',
\n
level: UIDevice.current.batteryLevel * 100,
\n
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
\n
}
\n
if (options.success != null) {\n options.success!(res)
\n
}
\n
if (options.complete != null) {\n options.complete!(res)
\n
}
\n
}
\n\n
export function test1() {\n console.log('test1')
\n
}
\n\n
class Test1 {}
\n
export class Test {\n constructor() {\n new Test1()
\n
}
\n
}
\n
"
],
"names"
:
[],
"mappings"
:
";AAAA;AAE6B,MAAxB,qBAAqB;IACxB,IAAA,IAAI,EAAE,MAAM,CAAA;IACZ,IAAA,GAAG,EAAE,QAAM,CAAA;IACX,IAAA,OAAO,EAAC,WAA8B,EAAA;IACtC,IAAA,IAAI,EAAC,WAA8B,EAAA;IACnC,IAAA,QAAQ,EAAC,WAA8B,EAAA;WAJvC,IAAI,EAAE,MAAM,IACZ,GAAG,EAAE,QAAM,IACX,OAAO,EAAC,WAA8B,IACtC,IAAI,EAAC,WAA8B,IACnC,QAAQ,EAAC,WAA8B;;;;;;;CACxC;AAoBD,MAAM,KAAK;CAAG;AACP,MAAM,IAAI;IACf,MAAc;QACZ,AAAI,KAAK,EAAE;IACb;CACD;;;;sBAvB6B,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;QAC3E,IAAM,GAAG,GAAG;YACV,CAAA,MAAM,GAAE,mBAAmB;YAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;YAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;0BAC5E;QACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI;YACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;;QAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI;YAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;;IAE1B;gBAEgB,KAAK,GAAG;QACtB,OAAO,CAAC,GAAG,CAAC,OAAO,wDAAC;IACtB"
}
\ No newline at end of file
packages/shims-uni-app.d.ts
浏览文件 @
de71b7e4
...
...
@@ -43,7 +43,7 @@ declare namespace UniNamespace {
router
?:
{
strict
:
boolean
base
:
string
assets
:
string
,
assets
:
string
routerBase
:
string
}
nvue
?:
{
...
...
packages/uni-api/src/protocols/location/locationChange.ts
浏览文件 @
de71b7e4
...
...
@@ -7,7 +7,8 @@ export type API_TYPE_STOP_LOCATION_UPDATE = typeof uni.stopLocationUpdate
export
const
API_OFF_LOCATION_CHANGE
=
'
offLocationChange
'
export
type
API_TYPE_OFF_LOCATION_CHANGE
=
typeof
uni
.
offLocationChange
export
const
API_OFF_LOCATION_CHANGE_ERROR
=
'
offLocationChangeError
'
export
type
API_TYPE_OFF_LOCATION_CHANGE_ERROR
=
typeof
uni
.
offLocationChangeError
export
type
API_TYPE_OFF_LOCATION_CHANGE_ERROR
=
typeof
uni
.
offLocationChangeError
export
const
API_ON_LOCATION_CHANGE_ERROR
=
'
onLocationChangeError
'
export
type
API_TYPE_ON_LOCATION_CHANGE_ERROR
=
typeof
uni
.
onLocationChangeError
...
...
@@ -15,7 +16,7 @@ const coordTypes = ['wgs84', 'gcj02']
export
const
StartLocationUpdateProtocol
:
ApiProtocol
<
API_TYPE_START_LOCATION_UPDATE
>
=
{
type
:
String
type
:
String
,
}
export
const
StartLocationUpdateOptions
:
ApiOptions
<
API_TYPE_START_LOCATION_UPDATE
>
=
...
...
@@ -28,6 +29,6 @@ export const StartLocationUpdateOptions: ApiOptions<API_TYPE_START_LOCATION_UPDA
}
else
{
params
.
type
=
value
}
}
}
}
\ No newline at end of file
},
},
}
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
de71b7e4
...
...
@@ -11719,13 +11719,13 @@ const ChooseLocationProtocol = {
};
const API_GET_LOCATION = 'getLocation';
const coordTypes = ['wgs84', 'gcj02'];
const coordTypes
$1
= ['wgs84', 'gcj02'];
const GetLocationOptions = {
formatArgs: {
type(value, params) {
value = (value || '').toLowerCase();
if (coordTypes.indexOf(value) === -1) {
params.type = coordTypes[0];
if (coordTypes
$1
.indexOf(value) === -1) {
params.type = coordTypes
$1
[0];
}
else {
params.type = value;
...
...
@@ -12145,6 +12145,30 @@ const CloseSocketProtocol = {
reason: String,
};
const API_START_LOCATION_UPDATE = 'startLocationUpdate';
const API_ON_LOCATION_CHANGE = 'onLocationChange';
const API_STOP_LOCATION_UPDATE = 'stopLocationUpdate';
const API_OFF_LOCATION_CHANGE = 'offLocationChange';
const API_OFF_LOCATION_CHANGE_ERROR = 'offLocationChangeError';
const API_ON_LOCATION_CHANGE_ERROR = 'onLocationChangeError';
const coordTypes = ['wgs84', 'gcj02'];
const StartLocationUpdateProtocol = {
type: String,
};
const StartLocationUpdateOptions = {
formatArgs: {
type(value, params) {
value = (value || '').toLowerCase();
if (coordTypes.indexOf(value) === -1) {
params.type = coordTypes[0];
}
else {
params.type = value;
}
},
},
};
function encodeQueryString(url) {
if (!isString(url)) {
return url;
...
...
@@ -16155,6 +16179,43 @@ const openLocation = defineAsyncApi(API_OPEN_LOCATION, (data, { resolve, reject
return resolve();
}, OpenLocationProtocol, OpenLocationOptions);
let watchId = 0;
/**
* 开始更新定位
*/
const startLocationUpdate = (defineAsyncApi(API_START_LOCATION_UPDATE, (_, { resolve, reject }) => {
if (plus.geolocation && watchId === 0) {
watchId = plus.geolocation.watchPosition((res) => {
UniServiceJSBridge.invokeOnCallback(API_ON_LOCATION_CHANGE, res.coords);
resolve();
}, (error) => {
reject(error.message);
}, {
coordsType: _ === null || _ === void 0 ? void 0 : _.type,
});
}
else {
UniServiceJSBridge.invokeOnCallback(API_ON_LOCATION_CHANGE_ERROR, 'onLocationChange:fail');
}
resolve();
}, StartLocationUpdateProtocol, StartLocationUpdateOptions));
const onLocationChange = (defineOnApi(API_ON_LOCATION_CHANGE, () => { }));
const stopLocationUpdate = (defineAsyncApi(API_STOP_LOCATION_UPDATE, (_, { resolve, reject }) => {
if (watchId) {
plus.geolocation.clearWatch(watchId);
watchId = 0;
resolve();
}
else {
reject('stopLocationUpdate:fail');
}
}));
const offLocationChange = (defineOffApi(API_OFF_LOCATION_CHANGE, () => {
stopLocationUpdate();
}));
const onLocationChangeError = (defineOnApi(API_ON_LOCATION_CHANGE_ERROR, () => { }));
const offLocationChangeError = (defineOnApi(API_OFF_LOCATION_CHANGE_ERROR, () => { }));
const showModal = defineAsyncApi(API_SHOW_MODAL, ({ title = '', content = '', showCancel = true, cancelText, cancelColor, confirmText, confirmColor, editable = false, placeholderText = '', } = {}, { resolve }) => {
const buttons = showCancel ? [cancelText, confirmText] : [confirmText];
const tip = editable ? placeholderText : buttons;
...
...
@@ -19375,6 +19436,12 @@ var uni$1 = {
getLocation: getLocation,
chooseLocation: chooseLocation,
openLocation: openLocation,
startLocationUpdate: startLocationUpdate,
onLocationChange: onLocationChange,
stopLocationUpdate: stopLocationUpdate,
offLocationChange: offLocationChange,
onLocationChangeError: onLocationChangeError,
offLocationChangeError: offLocationChangeError,
showModal: showModal,
showActionSheet: showActionSheet,
showLoading: showLoading,
...
...
packages/uni-app-plus/src/service/api/location/locationChange.ts
浏览文件 @
de71b7e4
...
...
@@ -15,43 +15,45 @@ import {
API_TYPE_OFF_LOCATION_CHANGE_ERROR
,
API_OFF_LOCATION_CHANGE_ERROR
,
API_TYPE_ON_LOCATION_CHANGE_ERROR
,
API_ON_LOCATION_CHANGE_ERROR
API_ON_LOCATION_CHANGE_ERROR
,
}
from
'
@dcloudio/uni-api
'
let
watchId
:
number
=
0
;
let
watchId
:
number
=
0
/**
* 开始更新定位
*/
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
defineAsyncApi
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
plus
.
geolocation
&&
watchId
===
0
)
{
watchId
=
plus
.
geolocation
.
watchPosition
(
(
res
)
=>
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE
,
res
.
coords
)
resolve
()
},
(
error
)
=>
{
reject
(
error
.
message
)
},
{
coordsType
:
_
?.
type
,
}
)
}
else
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE_ERROR
,
'
onLocationChange:fail
'
)
}
resolve
()
},
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
(
defineAsyncApi
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
plus
.
geolocation
&&
watchId
===
0
)
{
watchId
=
plus
.
geolocation
.
watchPosition
(
(
res
)
=>
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE
,
res
.
coords
)
resolve
()
},
(
error
)
=>
{
reject
(
error
.
message
)
},
{
coordsType
:
_
?.
type
,
}
)
}
else
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE_ERROR
,
'
onLocationChange:fail
'
)
}
resolve
()
},
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
)
)
export
const
onLocationChange
=
<
API_TYPE_ON_LOCATION_CHANGE
>
(
...
...
packages/uni-cli-shared/src/json/app/manifest/tabBar.ts
浏览文件 @
de71b7e4
...
...
@@ -2,7 +2,7 @@ import { SELECTED_COLOR, TABBAR_HEIGHT } from '@dcloudio/uni-shared'
const
borderStyles
=
{
black
:
'
rgba(0,0,0,0.4)
'
,
white
:
'
rgba(255,255,255,0.4)
'
white
:
'
rgba(255,255,255,0.4)
'
,
}
export
function
initTabBar
(
entryPagePath
:
string
,
...
...
@@ -17,7 +17,9 @@ export function initTabBar(
)
as
UniApp
.
TabBarOptions
if
(
tabBar
.
borderStyle
!
in
borderStyles
)
{
tabBar
.
borderStyle
=
(
borderStyles
[
tabBar
.
borderStyle
!
]
as
UniNamespace
.
TabBarOptions
[
'
borderStyle
'
])
tabBar
.
borderStyle
=
borderStyles
[
tabBar
.
borderStyle
!
]
as
UniNamespace
.
TabBarOptions
[
'
borderStyle
'
]
}
if
(
!
tabBar
.
selectedColor
)
{
...
...
packages/uni-components/dist/components.js
浏览文件 @
de71b7e4
import
{
createElementVNode
,
defineComponent
,
createVNode
,
mergeProps
,
getCurrentInstance
,
provide
,
watch
,
onUnmounted
,
shallowRef
,
reactive
,
watchEffect
,
ref
,
inject
,
onBeforeUnmount
,
computed
,
Text
as
Text$1
,
isVNode
,
Fragment
,
onMounted
,
resolveComponent
,
parseClassList
}
from
"
vue
"
;
import
{
createElementVNode
,
defineComponent
,
createVNode
,
mergeProps
,
getCurrentInstance
,
provide
,
watch
,
onUnmounted
,
shallowRef
,
reactive
,
watchEffect
,
ref
,
inject
,
onBeforeUnmount
,
computed
,
Text
as
Text$1
,
isVNode
,
Fragment
,
onMounted
,
Comment
,
resolveComponent
,
parseClassList
}
from
"
vue
"
;
import
{
extend
,
hasOwn
,
isFunction
,
isPlainObject
,
isArray
,
isString
}
from
"
@vue/shared
"
;
import
{
cacheStringFunction
,
PRIMARY_COLOR
}
from
"
@dcloudio/uni-shared
"
;
const
OPEN_TYPES
=
[
...
...
@@ -2260,7 +2260,9 @@ var PickerView = defineComponent({
const
state
=
useState
(
props2
);
const
trigger
=
useCustomEvent
(
rootRef
,
emit
);
let
columnVNodes
=
[];
const
getItemIndex
=
(
vnode
)
=>
Array
.
prototype
.
indexOf
.
call
(
columnVNodes
,
vnode
);
const
getItemIndex
=
(
vnode
)
=>
{
return
Array
.
prototype
.
indexOf
.
call
(
columnVNodes
.
filter
((
vnode2
)
=>
vnode2
.
type
!==
Comment
),
vnode
);
};
const
getPickerViewColumn
=
(
columnInstance
)
=>
{
return
computed
({
get
()
{
...
...
@@ -2302,7 +2304,7 @@ var PickerView = defineComponent({
preventGesture
:
true
}),
[
createVNode
(
"
view
"
,
{
"
class
"
:
"
uni-picker-view-wrapper
"
},
[
defaultSlot
s
])]);
},
[
columnVNode
s
])]);
};
},
styles
:
[{
...
...
@@ -2345,14 +2347,15 @@ const isAndroid$1 = weex.config.env.platform.toLowerCase() === "android";
function
getStyle
(
val
)
{
return
extend
({},
isString
(
val
)
?
parseStyleText
(
val
)
:
val
);
}
const
props$2
=
{
length
:
{
type
:
[
Number
,
String
],
default
:
0
}
};
var
PickerViewColumn
=
defineComponent
({
name
:
"
PickerViewColumn
"
,
props
:
{
length
:
{
type
:
[
Number
,
String
],
default
:
0
}
},
props
:
props$2
,
data
:
()
=>
({
_isMounted
:
false
}),
...
...
@@ -2373,37 +2376,10 @@ var PickerViewColumn = defineComponent({
indicatorHeight
.
value
=
getHeight
(
indicatorStyle
.
value
);
let
pickerViewHeight
=
ref
(
0
);
pickerViewHeight
.
value
=
parseFloat
(
pickerViewProps2
.
height
);
watch
(()
=>
props2
.
length
,
()
=>
{
setTimeout
(()
=>
{
setCurrent
(
current
.
value
,
true
,
true
);
},
150
);
});
let
scrollToElementTime
;
const
setCurrent
=
(
_current
,
animated
=
true
,
force
)
=>
{
if
(
current
.
value
===
_current
&&
!
force
)
{
return
;
}
dom
.
scrollToElement
(
contentRef
.
value
,
{
offset
:
_current
*
indicatorHeight
.
value
,
animated
});
current
.
value
=
_current
;
if
(
animated
)
{
scrollToElementTime
=
Date
.
now
();
}
};
const
onScrollend
=
(
event
)
=>
{
if
(
Date
.
now
()
-
scrollToElementTime
<
340
)
{
return
;
}
const
y
=
event
.
detail
.
contentOffset
.
y
;
const
_current
=
Math
.
round
(
y
/
indicatorHeight
.
value
);
if
(
y
%
indicatorHeight
.
value
)
{
setCurrent
(
_current
,
true
,
true
);
}
else
{
current
.
value
=
_current
;
}
};
const
{
setCurrent
,
onScrollend
}
=
usePickerColumnScroll
(
props2
,
current
,
contentRef
,
indicatorHeight
);
const
checkMounted
=
()
=>
{
let
height_
;
let
indicatorHeight_
;
...
...
@@ -2563,6 +2539,50 @@ function getHeight(style) {
}
return
value
;
}
function
usePickerColumnScroll
(
props2
,
current
,
contentRef
,
indicatorHeight
)
{
let
scrollToElementTime
;
watch
(()
=>
props2
.
length
,
()
=>
{
setTimeout
(()
=>
{
setCurrent
(
current
.
value
,
true
,
true
);
},
150
);
});
watch
(()
=>
current
.
value
,
(
_current
)
=>
{
dom
.
scrollToElement
(
contentRef
.
value
,
{
offset
:
_current
*
indicatorHeight
.
value
,
animated
:
true
});
scrollToElementTime
=
Date
.
now
();
});
const
setCurrent
=
(
_current
,
animated
=
true
,
force
)
=>
{
if
(
current
.
value
===
_current
&&
!
force
)
{
return
;
}
dom
.
scrollToElement
(
contentRef
.
value
,
{
offset
:
_current
*
indicatorHeight
.
value
,
animated
});
current
.
value
=
_current
;
if
(
animated
)
{
scrollToElementTime
=
Date
.
now
();
}
};
const
onScrollend
=
(
event
)
=>
{
if
(
Date
.
now
()
-
scrollToElementTime
<
340
)
{
return
;
}
const
y
=
event
.
detail
.
contentOffset
.
y
;
const
_current
=
Math
.
round
(
y
/
indicatorHeight
.
value
);
if
(
y
%
indicatorHeight
.
value
)
{
setCurrent
(
_current
,
true
,
true
);
}
else
{
current
.
value
=
_current
;
}
};
return
{
setCurrent
,
onScrollend
};
}
const
mode
=
{
SELECTOR
:
"
selector
"
,
MULTISELECTOR
:
"
multiSelector
"
,
...
...
packages/uni-h5-vite/src/plugins/manifestJson.ts
浏览文件 @
de71b7e4
...
...
@@ -11,7 +11,7 @@ const defaultRouter = {
mode
:
'
hash
'
,
base
:
'
/
'
,
assets
:
'
assets
'
,
routerBase
:
'
/
'
routerBase
:
'
/
'
,
}
const
defaultAsync
=
{
...
...
@@ -45,13 +45,13 @@ export function uniManifestJsonPlugin(): Plugin {
}
if
(
!
router
.
base
)
{
router
.
base
=
'
/
'
}
}
/**
* ssr时base和访问域名不一致导致跳到错误链接,其实应该区分server和client的部署路径,后续有需求可以加上
*/
router
.
routerBase
=
new
URL
(
router
.
base
,
'
http://localhost
'
).
pathname
const
async
=
{
...
defaultAsync
,
...((
h5
&&
h5
.
async
)
||
{})
}
const
networkTimeout
=
normalizeNetworkTimeout
(
manifest
.
networkTimeout
)
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
de71b7e4
...
...
@@ -7001,12 +7001,12 @@ function createRouterOptions() {
};
}
function
initHistory
()
{
let
{
b
ase
}
=
__uniConfig
.
router
;
if
(
b
ase
===
"
/
"
)
{
b
ase
=
""
;
let
{
routerB
ase
}
=
__uniConfig
.
router
;
if
(
routerB
ase
===
"
/
"
)
{
routerB
ase
=
""
;
}
{
return
vueRouter
.
createMemoryHistory
(
b
ase
);
return
vueRouter
.
createMemoryHistory
(
routerB
ase
);
}
}
var
index$f
=
{
...
...
@@ -10943,6 +10943,7 @@ const ICON_PATHS = {
none
:
""
,
forward
:
"
M11 7.844q-0.25-0.219-0.25-0.578t0.25-0.578q0.219-0.25 0.563-0.25t0.563 0.25l9.656 9.125q0.125 0.125 0.188 0.297t0.063 0.328q0 0.188-0.063 0.359t-0.188 0.297l-9.656 9.125q-0.219 0.25-0.563 0.25t-0.563-0.25q-0.25-0.219-0.25-0.578t0.25-0.609l9.063-8.594-9.063-8.594z
"
,
back
:
ICON_PATH_BACK
,
select
:
ICON_PATH_BACK
,
share
:
"
M26.563 24.844q0 0.125-0.109 0.234t-0.234 0.109h-17.938q-0.125 0-0.219-0.109t-0.094-0.234v-13.25q0-0.156 0.094-0.25t0.219-0.094h5.5v-1.531h-6q-0.531 0-0.906 0.391t-0.375 0.922v14.375q0 0.531 0.375 0.922t0.906 0.391h18.969q0.531 0 0.891-0.391t0.359-0.953v-5.156h-1.438v4.625zM29.813 10.969l-5.125-5.375-1.031 1.094 3.438 3.594-3.719 0.031q-2.313 0.188-4.344 1.125t-3.578 2.422-2.5 3.453-1.109 4.188l-0.031 0.25h1.469v-0.219q0.156-1.875 1-3.594t2.25-3.063 3.234-2.125 3.828-0.906l0.188-0.031 3.313-0.031-3.438 3.625 1.031 1.063 5.125-5.375-0.031-0.063 0.031-0.063z
"
,
favorite
:
"
M27.594 13.375q-0.063-0.188-0.219-0.313t-0.344-0.156l-7.094-0.969-3.219-6.406q-0.094-0.188-0.25-0.281t-0.375-0.094q-0.188 0-0.344 0.094t-0.25 0.281l-3.125 6.438-7.094 1.094q-0.188 0.031-0.344 0.156t-0.219 0.313q-0.031 0.188 0.016 0.375t0.172 0.313l5.156 4.969-1.156 7.063q-0.031 0.188 0.047 0.375t0.234 0.313q0.094 0.063 0.188 0.094t0.219 0.031q0.063 0 0.141-0.031t0.172-0.063l6.313-3.375 6.375 3.313q0.063 0.031 0.141 0.047t0.172 0.016q0.188 0 0.344-0.094t0.25-0.281q0.063-0.094 0.078-0.234t-0.016-0.234q0-0.031 0-0.063l-1.25-6.938 5.094-5.031q0.156-0.156 0.203-0.344t-0.016-0.375zM11.469 19.063q0.031-0.188-0.016-0.344t-0.172-0.281l-4.406-4.25 6.063-0.906q0.156-0.031 0.297-0.125t0.203-0.25l2.688-5.531 2.75 5.5q0.063 0.156 0.203 0.25t0.297 0.125l6.094 0.844-4.375 4.281q-0.125 0.125-0.172 0.297t-0.016 0.328l1.063 6.031-5.438-2.813q-0.156-0.094-0.328-0.078t-0.297 0.078l-5.438 2.875 1-6.031z
"
,
home
:
"
M23.719 16.5q-0.313 0-0.531 0.219t-0.219 0.5v7.063q0 0.219-0.172 0.391t-0.391 0.172h-12.344q-0.25 0-0.422-0.172t-0.172-0.391v-7.063q0-0.281-0.219-0.5t-0.531-0.219q-0.281 0-0.516 0.219t-0.234 0.5v7.063q0.031 0.844 0.625 1.453t1.438 0.609h12.375q0.844 0 1.453-0.609t0.609-1.453v-7.063q0-0.125-0.063-0.266t-0.156-0.234q-0.094-0.125-0.234-0.172t-0.297-0.047zM26.5 14.875l-8.813-8.813q-0.313-0.313-0.688-0.453t-0.781-0.141-0.781 0.141-0.656 0.422l-8.813 8.844q-0.188 0.219-0.188 0.516t0.219 0.484q0.094 0.125 0.234 0.172t0.297 0.047q0.125 0 0.25-0.047t0.25-0.141l8.781-8.781q0.156-0.156 0.406-0.156t0.406 0.156l8.813 8.781q0.219 0.188 0.516 0.188t0.516-0.219q0.188-0.188 0.203-0.484t-0.172-0.516z
"
,
...
...
@@ -11007,7 +11008,8 @@ function createButtonsTsx(btns) {
btnText
,
btnIconPath
,
badgeText
,
iconStyle
iconStyle
,
btnSelect
},
index2
)
=>
{
return
vue
.
createVNode
(
"
div
"
,
{
"
key
"
:
index2
,
...
...
@@ -11015,7 +11017,12 @@ function createButtonsTsx(btns) {
"
style
"
:
btnStyle
,
"
onClick
"
:
onClick
,
"
badge-text
"
:
badgeText
},
[
btnIconPath
?
createSvgIconVNode
(
btnIconPath
,
iconStyle
.
color
,
iconStyle
.
fontSize
)
:
vue
.
createVNode
(
"
i
"
,
{
},
[
btnIconPath
?
createSvgIconVNode
(
btnIconPath
,
iconStyle
.
color
,
iconStyle
.
fontSize
)
:
btnSelect
?
vue
.
createVNode
(
"
span
"
,
{
"
style
"
:
iconStyle
},
[
vue
.
createVNode
(
"
i
"
,
{
"
class
"
:
"
uni-btn-icon
"
,
"
innerHTML
"
:
btnText
},
null
,
8
,
[
"
innerHTML
"
]),
createSvgIconVNode
(
ICON_PATHS
[
"
select
"
],
"
#000
"
,
14
)],
4
)
:
vue
.
createVNode
(
"
i
"
,
{
"
class
"
:
"
uni-btn-icon
"
,
"
style
"
:
iconStyle
,
"
innerHTML
"
:
btnText
...
...
@@ -11218,7 +11225,8 @@ function usePageHeadButton(pageId, index2, btn, isTransparent) {
invokeHook
(
pageId
,
uniShared
.
ON_NAVIGATION_BAR_BUTTON_TAP
,
shared
.
extend
({
index
:
index2
},
btn
));
}
},
btnSelect
:
btn
.
select
};
}
function
usePageHeadSearchInput
({
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
de71b7e4
此差异已折叠。
点击以展开。
packages/uni-h5/src/service/api/location/locationChange.ts
浏览文件 @
de71b7e4
...
...
@@ -15,44 +15,44 @@ import {
API_TYPE_OFF_LOCATION_CHANGE_ERROR
,
API_OFF_LOCATION_CHANGE_ERROR
,
API_TYPE_ON_LOCATION_CHANGE_ERROR
,
API_ON_LOCATION_CHANGE_ERROR
API_ON_LOCATION_CHANGE_ERROR
,
}
from
'
@dcloudio/uni-api
'
import
{
translateGeo
,
}
from
'
../../../helpers/location
'
import
{
translateGeo
}
from
'
../../../helpers/location
'
let
watchId
:
number
=
0
;
let
watchId
:
number
=
0
/**
* 开始更新定位
*/
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
defineAsyncApi
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
navigator
.
geolocation
&&
watchId
===
0
)
{
watchId
=
navigator
.
geolocation
.
watchPosition
(
(
res
)
=>
{
translateGeo
(
_
?.
type
,
res
.
coords
)
.
then
((
coords
)
=>
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE
,
coords
)
resolve
()
})
.
catch
((
error
)
=>
{
reject
(
error
.
message
)
})
},
(
error
)
=>
{
reject
(
error
.
message
)
}
)
}
resolve
()
},
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
export
const
startLocationUpdate
=
<
API_TYPE_START_LOCATION_UPDATE
>
(
defineAsyncApi
(
API_START_LOCATION_UPDATE
,
(
_
,
{
resolve
,
reject
})
=>
{
if
(
navigator
.
geolocation
&&
watchId
===
0
)
{
watchId
=
navigator
.
geolocation
.
watchPosition
(
(
res
)
=>
{
translateGeo
(
_
?.
type
,
res
.
coords
)
.
then
((
coords
)
=>
{
UniServiceJSBridge
.
invokeOnCallback
(
API_ON_LOCATION_CHANGE
,
coords
)
resolve
()
})
.
catch
((
error
)
=>
{
reject
(
error
.
message
)
})
},
(
error
)
=>
{
reject
(
error
.
message
)
}
)
}
resolve
()
},
StartLocationUpdateProtocol
,
StartLocationUpdateOptions
)
)
export
const
onLocationChange
=
<
API_TYPE_ON_LOCATION_CHANGE
>
(
...
...
packages/uni-uts-vite/src/plugins/v1.ts
浏览文件 @
de71b7e4
...
...
@@ -43,7 +43,7 @@ export function uniUtsV1Plugin(): Plugin {
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-ios
'
?
'
swift
'
:
'
kotlin
'
)
const
pkg
=
parsePackage
(
filename
)
if
(
!
pkg
)
{
if
(
!
pkg
.
class
)
{
return
}
// 懒加载 uts 编译器
...
...
@@ -52,8 +52,8 @@ export function uniUtsV1Plugin(): Plugin {
const
ast
=
await
parse
(
code
,
{
noColor
:
isInHBuilderX
()
})
code
=
`
import { initUtsProxyClass, initUtsProxyFunction } from '@dcloudio/uni-app'
const pkg = '
${
pkg
}
'
const cls = '
IndexKt
'
const pkg = '
${
pkg
.
package
}
'
const cls = '
${
pkg
.
class
}
'
${
genProxyCode
(
ast
)}
`
const
res
=
await
compile
(
id
)
...
...
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
浏览文件 @
de71b7e4
...
...
@@ -22,9 +22,12 @@ import {
export
function
parseKotlinPackage
(
filename
:
string
)
{
const
res
=
resolvePackage
(
filename
)
if
(
!
res
)
{
return
''
return
{
package
:
''
,
class
:
''
}
}
return
{
package
:
'
uts.sdk.
'
+
(
res
.
is_uni_modules
?
'
modules.
'
:
''
)
+
res
.
name
,
class
:
'
IndexKt
'
,
}
return
'
uts.sdk.
'
+
(
res
.
is_uni_modules
?
'
modules.
'
:
''
)
+
res
.
name
}
export
async
function
compileKotlin
(
filename
:
string
)
{
...
...
@@ -41,8 +44,9 @@ export async function compileKotlin(filename: string) {
filename
,
},
output
:
{
isPlugin
:
true
,
outDir
:
outputDir
,
package
:
parseKotlinPackage
(
filename
),
package
:
parseKotlinPackage
(
filename
)
.
package
,
sourceMap
:
resolveSourceMapPath
(),
extname
:
'
kt
'
,
imports
:
[
...
...
packages/uni-uts-vite/src/utils/compiler/swift.ts
浏览文件 @
de71b7e4
...
...
@@ -5,9 +5,19 @@ import { genUTSPlatformResource, getUtsCompiler, resolvePackage } from './utils'
export
function
parseSwiftPackage
(
filename
:
string
)
{
const
res
=
resolvePackage
(
filename
)
if
(
!
res
)
{
return
''
return
{
package
:
''
,
namespace
:
''
,
class
:
''
,
}
}
const
namespace
=
'
UTSSDK
'
+
(
res
.
is_uni_modules
?
'
Modules
'
:
''
)
+
capitalize
(
res
.
name
)
return
{
package
:
''
,
namespace
,
class
:
namespace
+
'
IndexSwift
'
,
}
return
'
UTSSDK
'
+
(
res
.
is_uni_modules
?
'
Modules
'
:
''
)
+
capitalize
(
res
.
name
)
}
export
async
function
compileSwift
(
filename
:
string
)
{
...
...
@@ -28,8 +38,9 @@ export async function compileSwift(filename: string) {
filename
,
},
output
:
{
isPlugin
:
true
,
outDir
:
outputDir
,
package
:
''
,
package
:
parseSwiftPackage
(
filename
).
namespace
,
sourceMap
:
resolveSourceMapPath
(),
extname
:
'
swift
'
,
imports
:
[
'
DCUTSPlugin
'
],
...
...
packages/uni-uts-vite/src/utils/compiler/utils.ts
浏览文件 @
de71b7e4
...
...
@@ -52,13 +52,16 @@ export function genUTSPlatformResource(
})
}
// 生产模式下,需要将
kt
文件转移到 src 下
// 生产模式下,需要将
生成的平台
文件转移到 src 下
const
srcDir
=
path
.
resolve
(
utsOutputDir
,
'
src
'
)
if
(
!
fs
.
existsSync
(
srcDir
))
{
fs
.
mkdirSync
(
srcDir
)
}
if
(
fs
.
existsSync
(
platformFile
))
{
fs
.
moveSync
(
platformFile
,
path
.
resolve
(
utsOutputDir
,
'
src/index.kt
'
))
fs
.
moveSync
(
platformFile
,
path
.
resolve
(
utsOutputDir
,
'
src/index
'
+
options
.
extname
)
)
}
}
...
...
packages/uts-darwin-arm64/uts.darwin-arm64.node
浏览文件 @
de71b7e4
无法预览此类型文件
packages/uts-darwin-x64/uts.darwin-x64.node
浏览文件 @
de71b7e4
无法预览此类型文件
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
浏览文件 @
de71b7e4
无法预览此类型文件
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
浏览文件 @
de71b7e4
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录