Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
fba61e7e
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
720
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,发现更多精彩内容 >>
提交
fba61e7e
编写于
8月 07, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 优化 core components 中的平台判断
上级
c6964211
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
66 addition
and
60 deletion
+66
-60
src/core/service/api/context/create-map-context.js
src/core/service/api/context/create-map-context.js
+12
-10
src/core/view/components/button/index.vue
src/core/view/components/button/index.vue
+1
-1
src/core/view/components/canvas/index.vue
src/core/view/components/canvas/index.vue
+3
-3
src/core/view/components/editor/index.vue
src/core/view/components/editor/index.vue
+2
-2
src/core/view/mixins/keyboard.js
src/core/view/mixins/keyboard.js
+48
-44
未找到文件。
src/core/service/api/context/create-map-context.js
浏览文件 @
fba61e7e
import
{
invokeMethod
,
getCurrentPageVm
}
from
'
../../platform
'
}
from
'
../../platform
'
import
{
callback
...
...
@@ -16,8 +16,8 @@ UniServiceJSBridge.subscribe('onMapMethodCallback', ({
data
})
=>
{
callback
.
invoke
(
callbackId
,
data
)
})
})
const
methods
=
[
'
getCenterLocation
'
,
'
moveToLocation
'
,
'
getScale
'
,
'
getRegion
'
,
'
includePoints
'
,
'
translateMarker
'
]
export
class
MapContext
{
...
...
@@ -25,18 +25,20 @@ export class MapContext {
this
.
id
=
id
this
.
pageVm
=
pageVm
}
}
MapContext
.
prototype
.
$getAppMap
=
function
()
{
return
plus
.
maps
.
getMapById
(
this
.
pageVm
.
$page
.
id
+
'
-map-
'
+
this
.
id
)
}
}
MapContext
.
prototype
.
$getAppMap
=
function
()
{
if
(
__PLATFORM__
===
'
app-plus
'
)
{
return
plus
.
maps
.
getMapById
(
this
.
pageVm
.
$page
.
id
+
'
-map-
'
+
this
.
id
)
}
}
methods
.
forEach
(
function
(
method
)
{
MapContext
.
prototype
[
method
]
=
callback
.
warp
(
function
(
options
,
callbackId
)
{
MapContext
.
prototype
[
method
]
=
callback
.
warp
(
function
(
options
,
callbackId
)
{
options
.
callbackId
=
callbackId
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
method
,
options
)
})
})
})
export
function
createMapContext
(
id
,
context
)
{
if
(
context
)
{
...
...
src/core/view/components/button/index.vue
浏览文件 @
fba61e7e
...
...
@@ -65,7 +65,7 @@ export default {
)
return
}
if
(
this
.
openType
===
'
feedback
'
)
{
if
(
this
.
openType
===
'
feedback
'
&&
__PLATFORM__
===
'
app-plus
'
)
{
const
feedback
=
plus
.
webview
.
create
(
'
https://service.dcloud.net.cn/uniapp/feedback.html
'
,
'
feedback
'
,
...
...
src/core/view/components/canvas/index.vue
浏览文件 @
fba61e7e
...
...
@@ -351,17 +351,17 @@ export default {
loadBlob
(
this
.
response
)
}
}
xhr
.
onerror
=
window
.
plus
?
plusDownload
:
function
()
{
xhr
.
onerror
=
__PLATFORM__
===
'
app-plus
'
?
plusDownload
:
function
()
{
self
.
_images
[
src
].
src
=
src
}
xhr
.
send
()
}
if
(
window
.
plus
&&
(
!
window
.
webkit
||
!
window
.
webkit
.
messageHandlers
))
{
if
(
__PLATFORM__
===
'
app-plus
'
&&
(
!
window
.
webkit
||
!
window
.
webkit
.
messageHandlers
))
{
self
.
_images
[
src
].
src
=
src
}
else
{
// 解决 PLUS-APP(wkwebview)以及 H5 图像跨域问题(H5图像响应头需包含access-control-allow-origin)
if
(
window
.
plus
&&
src
.
indexOf
(
'
http://
'
)
!==
0
&&
src
.
indexOf
(
'
https://
'
)
!==
if
(
__PLATFORM__
===
'
app-plus
'
&&
src
.
indexOf
(
'
http://
'
)
!==
0
&&
src
.
indexOf
(
'
https://
'
)
!==
0
&&
!
/^data:.*,.*/
.
test
(
src
))
{
loadFile
(
src
)
}
else
if
(
/^data:.*,.*/
.
test
(
src
))
{
...
...
src/core/view/components/editor/index.vue
浏览文件 @
fba61e7e
...
...
@@ -226,7 +226,7 @@ export default {
return
}
const
script
=
document
.
createElement
(
'
script
'
)
script
.
src
=
window
.
plus
?
'
./__uniappquill.js
'
:
'
https://unpkg.com/quill@1.3.7/dist/quill.min.js
'
script
.
src
=
__PLATFORM__
===
'
app-plus
'
?
'
./__uniappquill.js
'
:
'
https://unpkg.com/quill@1.3.7/dist/quill.min.js
'
document
.
body
.
appendChild
(
script
)
script
.
onload
=
callback
},
...
...
@@ -238,7 +238,7 @@ export default {
return
}
const
script
=
document
.
createElement
(
'
script
'
)
script
.
src
=
window
.
plus
?
'
./__uniappquillimageresize.js
'
:
'
https://unpkg.com/quill-image-resize-mp@3.0.1/image-resize.min.js
'
script
.
src
=
__PLATFORM__
===
'
app-plus
'
?
'
./__uniappquillimageresize.js
'
:
'
https://unpkg.com/quill-image-resize-mp@3.0.1/image-resize.min.js
'
document
.
body
.
appendChild
(
script
)
script
.
onload
=
callback
},
...
...
src/core/view/mixins/keyboard.js
浏览文件 @
fba61e7e
...
...
@@ -28,7 +28,7 @@ export default {
},
watch
:
{
focus
(
val
)
{
if
(
val
&&
__PLATFORM__
===
'
app-plus
'
)
{
if
(
val
)
{
this
.
showSoftKeybord
()
}
}
...
...
@@ -49,68 +49,72 @@ export default {
}
UniViewJSBridge
.
subscribe
(
'
hideKeyboard
'
,
this
.
hideKeyboardTemp
)
document
.
addEventListener
(
'
click
'
,
iosHideKeyboard
,
false
)
if
(
__PLATFORM__
===
'
app-plus
'
)
{
this
.
setSoftinputNavBar
()
this
.
setSoftinputTemporary
()
}
this
.
setSoftinputNavBar
()
this
.
setSoftinputTemporary
()
})
el
.
addEventListener
(
'
blur
'
,
this
.
onKeyboardHide
.
bind
(
this
))
},
showSoftKeybord
()
{
plusReady
(()
=>
{
plus
.
key
.
showSoftKeybord
()
})
if
(
__PLATFORM__
===
'
app-plus
'
)
{
plusReady
(()
=>
{
plus
.
key
.
showSoftKeybord
()
})
}
},
setSoftinputTemporary
()
{
plusReady
(()
=>
{
const
currentWebview
=
plus
.
webview
.
currentWebview
()
const
style
=
currentWebview
.
getStyle
()
||
{}
const
rect
=
this
.
$el
.
getBoundingClientRect
()
currentWebview
.
setSoftinputTemporary
&&
currentWebview
.
setSoftinputTemporary
({
mode
:
style
.
softinputMode
===
'
adjustResize
'
?
'
adjustResize
'
:
(
this
.
adjustPosition
?
'
adjustPan
'
:
'
nothing
'
),
position
:
{
top
:
rect
.
top
,
height
:
rect
.
height
+
(
Number
(
this
.
cursorSpacing
)
||
0
)
}
if
(
__PLATFORM__
===
'
app-plus
'
)
{
plusReady
(()
=>
{
const
currentWebview
=
plus
.
webview
.
currentWebview
()
const
style
=
currentWebview
.
getStyle
()
||
{}
const
rect
=
this
.
$el
.
getBoundingClientRect
()
currentWebview
.
setSoftinputTemporary
&&
currentWebview
.
setSoftinputTemporary
({
mode
:
style
.
softinputMode
===
'
adjustResize
'
?
'
adjustResize
'
:
(
this
.
adjustPosition
?
'
adjustPan
'
:
'
nothing
'
),
position
:
{
top
:
rect
.
top
,
height
:
rect
.
height
+
(
Number
(
this
.
cursorSpacing
)
||
0
)
}
})
})
}
)
}
},
setSoftinputNavBar
()
{
if
(
this
.
showConfirmBar
===
'
auto
'
)
{
delete
this
.
__softinputNavBar
return
}
plusReady
(()
=>
{
const
currentWebview
=
plus
.
webview
.
currentWebview
()
const
{
softinputNavBar
}
=
currentWebview
.
getStyle
()
||
{}
const
showConfirmBar
=
softinputNavBar
!==
'
none
'
if
(
showConfirmBar
!==
this
.
showConfirmBar
)
{
this
.
__softinputNavBar
=
softinputNavBar
||
'
auto
'
currentWebview
.
setStyle
({
softinputNavBar
:
this
.
showConfirmBar
?
'
auto
'
:
'
none
'
})
}
else
{
if
(
__PLATFORM__
===
'
app-plus
'
)
{
if
(
this
.
showConfirmBar
===
'
auto
'
)
{
delete
this
.
__softinputNavBar
return
}
})
},
resetSoftinputNavBar
()
{
const
softinputNavBar
=
this
.
__softinputNavBar
if
(
softinputNavBar
)
{
plusReady
(()
=>
{
const
currentWebview
=
plus
.
webview
.
currentWebview
()
currentWebview
.
setStyle
({
softinputNavBar
})
const
{
softinputNavBar
}
=
currentWebview
.
getStyle
()
||
{}
const
showConfirmBar
=
softinputNavBar
!==
'
none
'
if
(
showConfirmBar
!==
this
.
showConfirmBar
)
{
this
.
__softinputNavBar
=
softinputNavBar
||
'
auto
'
currentWebview
.
setStyle
({
softinputNavBar
:
this
.
showConfirmBar
?
'
auto
'
:
'
none
'
})
}
else
{
delete
this
.
__softinputNavBar
}
})
}
},
resetSoftinputNavBar
()
{
if
(
__PLATFORM__
===
'
app-plus
'
)
{
const
softinputNavBar
=
this
.
__softinputNavBar
if
(
softinputNavBar
)
{
plusReady
(()
=>
{
const
currentWebview
=
plus
.
webview
.
currentWebview
()
currentWebview
.
setStyle
({
softinputNavBar
})
})
}
}
},
onKeyboardHide
()
{
UniViewJSBridge
.
unsubscribe
(
'
hideKeyboard
'
,
this
.
hideKeyboardTemp
)
document
.
removeEventListener
(
'
click
'
,
iosHideKeyboard
,
false
)
if
(
__PLATFORM__
===
'
app-plus
'
)
{
this
.
resetSoftinputNavBar
()
}
this
.
resetSoftinputNavBar
()
// 修复ios端显示与点击位置错位的Bug by:wyq
if
(
String
(
navigator
.
vendor
).
indexOf
(
'
Apple
'
)
===
0
)
{
document
.
documentElement
.
scrollTo
(
document
.
documentElement
.
scrollLeft
,
document
.
documentElement
.
scrollTop
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录