Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wychl
uni-app
提交
d9fc80eb
U
uni-app
项目概览
wychl
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9fc80eb
编写于
4月 16, 2020
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 组件getRealPath过滤src空值
上级
e380df20
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
30 deletion
+30
-30
src/core/view/components/canvas/index.vue
src/core/view/components/canvas/index.vue
+25
-25
src/core/view/components/image/index.vue
src/core/view/components/image/index.vue
+3
-3
src/core/view/mixins/base.js
src/core/view/mixins/base.js
+2
-2
未找到文件。
src/core/view/components/canvas/index.vue
浏览文件 @
d9fc80eb
<
template
>
<uni-canvas
:canvas-id=
"canvasId"
:disable-scroll=
"disableScroll"
v-on=
"_listeners"
<uni-canvas
:canvas-id=
"canvasId"
:disable-scroll=
"disableScroll"
v-on=
"_listeners"
>
<canvas
ref=
"canvas"
width=
"300"
height=
"150"
<canvas
ref=
"canvas"
width=
"300"
height=
"150"
/>
<div
style=
"position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;"
>
<slot
/>
</div>
<v-uni-resize-sensor
ref=
"sensor"
@
resize=
"_resize"
<v-uni-resize-sensor
ref=
"sensor"
@
resize=
"_resize"
/>
</uni-canvas>
</
template
>
...
...
@@ -279,37 +279,37 @@ export default {
}
},
preloadImage
:
function
(
actions
)
{
var
se
fl
=
this
var
se
lf
=
this
actions
.
forEach
(
function
(
action
)
{
var
method
=
action
.
method
var
data
=
action
.
data
var
src
=
''
if
(
method
===
'
drawImage
'
)
{
src
=
data
[
0
]
src
=
se
fl
.
$getRealPath
(
src
)
src
=
se
lf
.
$getRealPath
(
src
)
data
[
0
]
=
src
}
else
if
(
method
===
'
setFillStyle
'
&&
data
[
0
]
===
'
pattern
'
)
{
src
=
data
[
1
]
src
=
se
fl
.
$getRealPath
(
src
)
src
=
se
lf
.
$getRealPath
(
src
)
data
[
1
]
=
src
}
if
(
src
&&
!
se
fl
.
_images
[
src
])
{
if
(
src
&&
!
se
lf
.
_images
[
src
])
{
loadImage
()
}
/**
* 加载图像
*/
function
loadImage
()
{
se
fl
.
_images
[
src
]
=
new
Image
()
se
fl
.
_images
[
src
].
onload
=
function
()
{
se
fl
.
_images
[
src
].
ready
=
true
se
lf
.
_images
[
src
]
=
new
Image
()
se
lf
.
_images
[
src
].
onload
=
function
()
{
se
lf
.
_images
[
src
].
ready
=
true
}
/**
* 从Blob加载
* @param {Blob} blob
*/
function
loadBlob
(
blob
)
{
se
fl
.
_images
[
src
].
src
=
(
window
.
URL
||
window
.
webkitURL
).
createObjectURL
(
blob
)
se
lf
.
_images
[
src
].
src
=
(
window
.
URL
||
window
.
webkitURL
).
createObjectURL
(
blob
)
}
/**
* 从本地文件加载
...
...
@@ -318,7 +318,7 @@ export default {
function
loadFile
(
path
)
{
var
bitmap
=
new
plus
.
nativeObj
.
Bitmap
(
'
bitmap
'
+
Date
.
now
())
bitmap
.
load
(
path
,
function
()
{
se
fl
.
_images
[
src
].
src
=
bitmap
.
toBase64Data
()
se
lf
.
_images
[
src
].
src
=
bitmap
.
toBase64Data
()
bitmap
.
clear
()
},
function
()
{
bitmap
.
clear
()
...
...
@@ -337,7 +337,7 @@ export default {
if
(
status
===
200
)
{
loadFile
(
d
.
filename
)
}
else
{
se
fl
.
_images
[
src
].
src
=
src
se
lf
.
_images
[
src
].
src
=
src
}
}).
start
()
}
...
...
@@ -350,20 +350,20 @@ export default {
}
}
xhr
.
onerror
=
window
.
plus
?
plusDownload
:
function
()
{
se
fl
.
_images
[
src
].
src
=
src
se
lf
.
_images
[
src
].
src
=
src
}
xhr
.
send
()
}
if
(
window
.
plus
&&
(
!
window
.
webkit
||
!
window
.
webkit
.
messageHandlers
))
{
se
fl
.
_images
[
src
].
src
=
src
se
lf
.
_images
[
src
].
src
=
src
}
else
{
// 解决 PLUS-APP(wkwebview)以及 H5 图像跨域问题(H5图像响应头需包含access-control-allow-origin)
if
(
window
.
plus
&&
src
.
indexOf
(
'
http://
'
)
!==
0
&&
src
.
indexOf
(
'
https://
'
)
!==
0
)
{
loadFile
(
src
)
}
else
if
(
/^data:.*,.*/
.
test
(
src
))
{
se
fl
.
_images
[
src
].
src
=
src
se
lf
.
_images
[
src
].
src
=
src
}
else
{
loadUrl
(
src
)
}
...
...
@@ -449,7 +449,7 @@ export default {
},
this
.
$page
.
id
)
return
}
if
(
!
callbackId
)
{
if
(
!
callbackId
)
{
// fix [...]展开TypedArray在低版本手机报错的问题,使用Array.prototype.slice
return
{
data
:
Array
.
prototype
.
slice
.
call
(
imgData
.
data
),
...
...
src/core/view/components/image/index.vue
浏览文件 @
d9fc80eb
...
...
@@ -2,13 +2,13 @@
<uni-image
v-on=
"$listeners"
>
<div
ref=
"content"
:style=
"modeStyle"
:style=
"modeStyle"
/>
<img
:src=
"realImagePath"
>
<v-uni-resize-sensor
v-if=
"mode === 'widthFix'"
ref=
"sensor"
@
resize=
"_resize"
@
resize=
"_resize"
/>
</uni-image>
</
template
>
...
...
@@ -43,7 +43,7 @@ export default {
return
this
.
originalWidth
&&
this
.
originalHeight
?
this
.
originalWidth
/
this
.
originalHeight
:
0
},
realImagePath
()
{
return
this
.
src
&&
this
.
$getRealPath
(
this
.
src
)
return
this
.
$getRealPath
(
this
.
src
)
},
modeStyle
()
{
let
size
=
'
auto
'
...
...
src/core/view/mixins/base.js
浏览文件 @
d9fc80eb
...
...
@@ -6,10 +6,10 @@ import {
export
default
{
methods
:
{
$getRealPath
(
src
)
{
return
getRealPath
(
src
)
return
src
?
getRealPath
(
src
)
:
src
},
$trigger
(
name
,
$event
,
detail
)
{
this
.
$emit
(
name
,
processEvent
.
call
(
this
,
name
,
$event
,
detail
,
this
.
$el
,
this
.
$el
))
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录