Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
313f1354
U
uni-app
项目概览
陈庄旺
/
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,发现更多精彩内容 >>
提交
313f1354
编写于
4月 07, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: allowJs
上级
4fb41fe8
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
3660 addition
and
15 deletion
+3660
-15
packages/uni-api/src/service/context/createVideoContext.ts
packages/uni-api/src/service/context/createVideoContext.ts
+73
-0
packages/uni-api/src/service/ui/createIntersectionObserver.ts
...ages/uni-api/src/service/ui/createIntersectionObserver.ts
+1
-3
packages/uni-core/src/helpers/bridge.ts
packages/uni-core/src/helpers/bridge.ts
+5
-5
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+4
-4
packages/uni-h5/src/platform/index.ts
packages/uni-h5/src/platform/index.ts
+2
-1
packages/uni-h5/src/service/api/base/getBaseSystemInfo.ts
packages/uni-h5/src/service/api/base/getBaseSystemInfo.ts
+0
-0
packages/uni-h5/src/service/api/context/operateVideoPlayer.ts
...ages/uni-h5/src/service/api/context/operateVideoPlayer.ts
+19
-0
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
+1
-1
packages/uni-h5/src/view/components/ad/index.vue
packages/uni-h5/src/view/components/ad/index.vue
+426
-0
packages/uni-h5/src/view/components/cover-image/index.vue
packages/uni-h5/src/view/components/cover-image/index.vue
+72
-0
packages/uni-h5/src/view/components/cover-view/index.vue
packages/uni-h5/src/view/components/cover-view/index.vue
+79
-0
packages/uni-h5/src/view/components/map/index.vue
packages/uni-h5/src/view/components/map/index.vue
+941
-0
packages/uni-h5/src/view/components/picker/index.vue
packages/uni-h5/src/view/components/picker/index.vue
+873
-0
packages/uni-h5/src/view/components/video/index.vue
packages/uni-h5/src/view/components/video/index.vue
+1079
-0
packages/uni-h5/src/view/components/web-view/README.md
packages/uni-h5/src/view/components/web-view/README.md
+15
-0
packages/uni-h5/src/view/components/web-view/index.vue
packages/uni-h5/src/view/components/web-view/index.vue
+69
-0
tsconfig.json
tsconfig.json
+1
-1
未找到文件。
packages/uni-api/src/service/context/createVideoContext.ts
0 → 100644
浏览文件 @
313f1354
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
operateVideoPlayer
}
from
'
@dcloudio/uni-platform
'
import
{
getCurrentPageVm
}
from
'
../../helpers/utils
'
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
,
2.0
]
export
class
VideoContext
{
private
id
:
string
private
vm
:
ComponentPublicInstance
constructor
(
id
:
string
,
vm
:
ComponentPublicInstance
)
{
this
.
id
=
id
this
.
vm
=
vm
}
play
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
play
'
)
}
pause
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
pause
'
)
}
stop
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
stop
'
)
}
seek
(
position
:
number
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
seek
'
,
{
position
,
})
}
sendDanmu
(
args
:
WechatMiniprogram
.
Danmu
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
sendDanmu
'
,
args
)
}
playbackRate
(
rate
:
number
)
{
if
(
!~
RATES
.
indexOf
(
rate
))
{
rate
=
1.0
}
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
playbackRate
'
,
{
rate
,
})
}
requestFullScreen
(
args
:
WechatMiniprogram
.
VideoContextRequestFullScreenOption
=
{}
)
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
requestFullScreen
'
,
args
)
}
exitFullScreen
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
exitFullScreen
'
)
}
showStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
showStatusBar
'
)
}
hideStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
vm
,
'
hideStatusBar
'
)
}
}
export
function
createVideoContext
(
id
:
string
,
context
:
ComponentPublicInstance
)
{
if
(
context
)
{
return
new
VideoContext
(
id
,
context
)
}
return
new
VideoContext
(
id
,
getCurrentPageVm
())
}
packages/uni-api/src/service/ui/createIntersectionObserver.ts
浏览文件 @
313f1354
import
{
extend
}
from
'
@vue/shared
'
import
{
ServiceJSBridge
}
from
'
@dcloudio/uni-core
'
import
{
defineSyncApi
}
from
'
../../helpers/api
'
import
{
getCurrentPageVm
}
from
'
../../helpers/utils
'
...
...
@@ -37,7 +35,7 @@ const reqComponentObserverCallbacks: Record<number, ObserveResultCallback> = {}
export
const
API_CREATE_INTERSECTION_OBSERVER
=
'
createIntersectionObserver
'
ServiceJSBridge
.
subscribe
(
Uni
ServiceJSBridge
.
subscribe
(
'
requestComponentObserver
'
,
({
reqId
,
reqEnd
,
res
}:
requestComponentObserver
)
=>
{
const
callback
=
reqComponentObserverCallbacks
[
reqId
]
...
...
packages/uni-core/src/helpers/bridge.ts
浏览文件 @
313f1354
import
{
extend
}
from
'
@vue/shared
'
//
@ts-ignore
TODO 等待 vue3 的兼容模式自带emitter
// TODO 等待 vue3 的兼容模式自带emitter
import
E
from
'
./TinyEmitter
'
export
function
initBridge
(
namespace
:
'
service
'
|
'
view
'
):
UniApp
.
UniServiceJSBridge
{
):
Partial
<
UniApp
.
UniServiceJSBridge
>
{
// TODO vue3 compatibility builds
const
emitter
=
new
E
()
return
extend
(
emitter
,
{
subscribe
(
event
:
string
,
callback
:
Function
):
void
{
return
emitter
.
on
(
`
${
namespace
}
.
${
event
}
`
,
callback
)
emitter
.
on
(
`
${
namespace
}
.
${
event
}
`
,
callback
)
},
unsubscribe
(
event
:
string
,
callback
:
Function
):
void
{
return
emitter
.
off
(
`
${
namespace
}
.
${
event
}
`
,
callback
)
emitter
.
off
(
`
${
namespace
}
.
${
event
}
`
,
callback
)
},
subscribeHandler
(
event
:
string
,
args
:
unknown
,
pageId
:
number
):
void
{
if
(
__DEV__
)
{
...
...
@@ -22,7 +22,7 @@ export function initBridge(
)}
,
${
pageId
}
`
)
}
return
emitter
.
emit
(
`
${
namespace
}
.
${
event
}
`
,
args
,
pageId
)
emitter
.
emit
(
`
${
namespace
}
.
${
event
}
`
,
args
,
pageId
)
},
})
}
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
313f1354
...
...
@@ -103,16 +103,16 @@ function initBridge(namespace) {
const
emitter2
=
new
E
();
return
extend
(
emitter2
,
{
subscribe
(
event2
,
callback
)
{
return
emitter2
.
on
(
`
${
namespace
}
.
${
event2
}
`
,
callback
);
emitter2
.
on
(
`
${
namespace
}
.
${
event2
}
`
,
callback
);
},
unsubscribe
(
event2
,
callback
)
{
return
emitter2
.
off
(
`
${
namespace
}
.
${
event2
}
`
,
callback
);
emitter2
.
off
(
`
${
namespace
}
.
${
event2
}
`
,
callback
);
},
subscribeHandler
(
event2
,
args
,
pageId
)
{
if
(
process
.
env
.
NODE_ENV
!==
"
production
"
)
{
console
.
log
(
`[
${
namespace
}
][subscribeHandler][
${
Date
.
now
()}
]:
${
event2
}
,
${
JSON
.
stringify
(
args
)}
,
${
pageId
}
`
);
}
return
emitter2
.
emit
(
`
${
namespace
}
.
${
event2
}
`
,
args
,
pageId
);
emitter2
.
emit
(
`
${
namespace
}
.
${
event2
}
`
,
args
,
pageId
);
}
});
}
...
...
@@ -8024,7 +8024,7 @@ const defaultOptions = {
let
reqComponentObserverId
=
1
;
const
reqComponentObserverCallbacks
=
{};
const
API_CREATE_INTERSECTION_OBSERVER
=
"
createIntersectionObserver
"
;
ServiceJSBridge
.
subscribe
(
"
requestComponentObserver
"
,
({
reqId
,
reqEnd
,
res
})
=>
{
Uni
ServiceJSBridge
.
subscribe
(
"
requestComponentObserver
"
,
({
reqId
,
reqEnd
,
res
})
=>
{
const
callback
=
reqComponentObserverCallbacks
[
reqId
];
if
(
callback
)
{
if
(
reqEnd
)
{
...
...
packages/uni-h5/src/platform/index.ts
浏览文件 @
313f1354
export
*
from
'
./getRealPath
'
export
{
getBaseSystemInfo
}
from
'
./getBaseSystemInfo
'
export
{
getBaseSystemInfo
}
from
'
../service/api/base/getBaseSystemInfo
'
export
{
operateVideoPlayer
}
from
'
../service/api/context/operateVideoPlayer
'
packages/uni-h5/src/
platform
/getBaseSystemInfo.ts
→
packages/uni-h5/src/
service/api/base
/getBaseSystemInfo.ts
浏览文件 @
313f1354
文件已移动
packages/uni-h5/src/service/api/context/operateVideoPlayer.ts
0 → 100644
浏览文件 @
313f1354
import
{
ComponentPublicInstance
}
from
'
vue
'
export
function
operateVideoPlayer
(
videoId
:
string
,
vm
:
ComponentPublicInstance
,
type
:
string
,
data
?:
unknown
)
{
const
pageId
=
vm
.
$page
.
id
UniServiceJSBridge
.
publishHandler
(
pageId
+
'
-video-
'
+
videoId
,
{
videoId
,
type
,
data
,
},
pageId
)
}
packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
浏览文件 @
313f1354
...
...
@@ -13,7 +13,7 @@ import {
getScreenWidth
,
getWindowWidth
,
getScreenHeight
,
}
from
'
../
../../platform
/getBaseSystemInfo
'
}
from
'
../
base
/getBaseSystemInfo
'
/**
* 获取系统信息-同步
...
...
packages/uni-h5/src/view/components/ad/index.vue
0 → 100644
浏览文件 @
313f1354
<
template
>
<uni-ad
v-bind=
"attrs"
v-on=
"$listeners"
>
<div
ref=
"container"
class=
"uni-ad-container"
@
click=
"_onhandle"
/>
</uni-ad>
</
template
>
<
script
>
import
{
subscriber
}
from
'
uni-mixins
'
class
AdConfig
{
static
get
instance
()
{
if
(
this
.
_instance
==
null
)
{
this
.
_instance
=
new
AdConfig
()
this
.
_instance
.
_init
()
}
return
this
.
_instance
}
static
IC
=
0
static
IS
=
0
constructor
()
{
this
.
_instance
=
null
this
.
_adConfig
=
null
this
.
_isLoading
=
false
this
.
_lastError
=
null
this
.
_callbacks
=
[]
}
get
adConfig
()
{
return
this
.
_adConfig
}
get
isExpired
()
{
if
(
this
.
_adConfig
==
null
)
{
return
true
}
return
(
Math
.
abs
(
Date
.
now
()
-
this
.
_adConfig
.
last
)
>
this
.
CACHE_TIME
)
}
_init
()
{
var
config
=
this
.
_getConfig
()
if
(
config
===
null
||
!
config
.
last
)
{
return
}
if
(
!
this
.
isExpired
)
{
this
.
_adConfig
=
config
.
data
}
}
get
(
adpid
,
success
,
fail
)
{
AdConfig
.
IC
++
if
(
this
.
_adConfig
!=
null
)
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
if
(
this
.
isExpired
)
{
this
.
_loadAdConfig
(
adpid
)
}
return
}
this
.
_callbacks
.
push
({
adpid
:
adpid
,
success
:
success
,
fail
:
fail
})
this
.
_loadAdConfig
(
adpid
)
}
_doCallback
(
adpid
,
success
,
fail
)
{
AdConfig
.
IS
++
var
data
=
this
.
_adConfig
if
(
data
[
adpid
])
{
success
(
data
[
adpid
])
}
else
{
fail
(
this
.
ERROR_INVALID_ADPID
)
}
}
_loadAdConfig
(
adpid
)
{
if
(
this
.
_isLoading
===
true
)
{
return
}
this
.
_isLoading
=
true
uni
.
request
({
url
:
this
.
URL
,
method
:
'
GET
'
,
timeout
:
5000
,
data
:
{
d
:
location
.
hostname
,
a
:
adpid
},
dataType
:
'
json
'
,
success
:
(
res
)
=>
{
const
rd
=
res
.
data
if
(
rd
.
ret
===
0
)
{
const
data
=
rd
.
data
this
.
_adConfig
=
data
this
.
_setConfig
(
data
)
this
.
_callbacks
.
forEach
(({
adpid
,
success
,
fail
})
=>
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
})
}
else
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
({
errCode
:
rd
.
ret
,
errMsg
:
rd
.
msg
})
})
}
this
.
_callbacks
=
[]
},
fail
:
(
err
)
=>
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
(
err
)
})
this
.
_callbacks
=
[]
},
complete
:
(
c
)
=>
{
this
.
_isLoading
=
false
}
})
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
this
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
data
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
this
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
data
:
data
}))
}
}
Object
.
assign
(
AdConfig
.
prototype
,
{
URL
:
'
//qy5y9ee9ch8r87pg72w5.dcloud.net.cn/hcs
'
,
KEY
:
'
uni_app_ad_config
'
,
CACHE_TIME
:
1000
*
60
*
10
,
ERROR_INVALID_ADPID
:
{
'
-5002
'
:
'
无效adpid
'
}
})
class
AdReport
{
static
get
instance
()
{
if
(
this
.
_instance
==
null
)
{
this
.
_instance
=
new
AdReport
()
this
.
_instance
.
_init
()
}
return
this
.
_instance
}
constructor
()
{
this
.
_instance
=
null
this
.
_adConfig
=
null
this
.
_guid
=
null
}
_init
()
{
var
config
=
this
.
_getConfig
()
if
(
config
!==
null
&&
config
.
guid
)
{
this
.
_guid
=
config
.
guid
return
}
this
.
_guid
=
this
.
_newGUID
()
this
.
_setConfig
(
this
.
_guid
)
}
get
(
data
)
{
this
.
_process
(
Object
.
assign
(
data
,
{
d
:
location
.
hostname
,
i
:
this
.
_guid
}))
}
_process
(
data
)
{
uni
.
request
({
url
:
this
.
URL
,
method
:
'
GET
'
,
data
:
data
,
dataType
:
'
json
'
,
success
:
()
=>
{
}
})
}
_newGUID
()
{
let
guid
=
''
const
format
=
'
xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
'
for
(
let
i
=
0
;
i
<
format
.
length
;
i
++
)
{
if
(
format
[
i
]
===
'
x
'
)
{
guid
+=
(
Math
.
random
()
*
16
|
0
).
toString
(
16
)
}
else
{
guid
+=
format
[
i
]
}
}
return
guid
.
toUpperCase
()
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
this
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
guid
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
this
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
guid
:
guid
}))
}
}
Object
.
assign
(
AdReport
.
prototype
,
{
URL
:
'
//hp66hwpyev7yx2hfughh.dcloud.net.cn/ahl
'
,
KEY
:
'
uni_app_ad_guid
'
})
const
adProvider
=
{
hx
:
'
zswx_hx
'
,
ky
:
'
zswx_ky
'
}
const
CHECK_RENDER_DELAY
=
1000
const
CHECK_RENDER_RETRY
=
3
export
default
{
name
:
'
Ad
'
,
mixins
:
[
subscriber
],
props
:
{
adpid
:
{
type
:
[
Number
,
String
],
default
:
''
}
},
watch
:
{
adpid
(
val
)
{
if
(
val
)
{
this
.
_loadData
(
val
)
}
}
},
mounted
()
{
this
.
_pl
=
[]
this
.
_pd
=
{}
this
.
_pi
=
0
this
.
_checkTimer
=
null
this
.
_checkTimerCount
=
0
this
.
_loadData
()
AdReport
.
instance
.
get
({
h
:
__uniConfig
.
compilerVersion
,
a
:
this
.
adpid
,
at
:
30
,
ic
:
AdConfig
.
IC
,
is
:
AdConfig
.
IS
})
},
beforeDestroy
()
{
this
.
_clearCheckTimer
()
this
.
$refs
.
container
.
innerHTML
=
''
},
methods
:
{
_onhandle
(
e
)
{
this
.
_report
(
41
)
},
_reset
()
{
this
.
_pl
=
[]
this
.
_pd
=
{}
this
.
_pi
=
0
this
.
_clearCheckTimer
()
this
.
$refs
.
container
.
innerHTML
=
''
},
_loadData
(
adpid
)
{
this
.
_reset
()
AdConfig
.
instance
.
get
(
adpid
||
this
.
adpid
,
(
data
)
=>
{
this
.
_pd
=
data
this
.
_pl
=
data
.
psp
.
split
(
'
,
'
)
this
.
_renderAd
()
},
(
err
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
err
)
})
},
_renderAd
()
{
if
(
this
.
_pi
>
this
.
_pl
.
length
-
1
)
{
return
}
var
ap
=
this
.
_pl
[
this
.
_pi
]
var
data
=
this
.
_pd
[
ap
]
switch
(
ap
)
{
case
adProvider
.
hx
:
this
.
_renderHX
(
data
)
break
case
adProvider
.
ky
:
this
.
_renderKY
(
data
)
break
}
},
_renderNext
()
{
if
(
this
.
_pi
>=
this
.
_pl
.
length
-
1
)
{
return
}
this
.
_pi
++
this
.
_renderAd
()
},
_renderHX
(
data
)
{
if
(
document
.
querySelector
(
'
#
'
+
adProvider
.
hx
))
{
this
.
_renderNext
()
return
}
var
ad
=
document
.
createElement
(
'
script
'
)
ad
.
src
=
data
.
src
||
data
.
url
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
id
'
,
adProvider
.
hx
)
adView
.
appendChild
(
ad
)
this
.
$refs
.
container
.
innerHTML
=
''
this
.
$refs
.
container
.
append
(
adView
)
this
.
_startCheckTimer
()
},
_renderKY
(
data
)
{
var
randomId
=
this
.
_randomId
()
var
ad
=
document
.
createElement
(
'
script
'
)
ad
.
src
=
(
data
.
src
||
data
.
url
)
+
'
&_ct=
'
+
randomId
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
id
'
,
randomId
)
adView
.
appendChild
(
ad
)
this
.
$refs
.
container
.
innerHTML
=
''
this
.
$refs
.
container
.
append
(
adView
)
this
.
_startCheckTimer
()
},
_checkRender
()
{
var
hasContent
=
(
this
.
$refs
.
container
.
children
.
length
>
0
&&
this
.
$refs
.
container
.
clientHeight
>
40
)
if
(
hasContent
)
{
this
.
_report
(
40
)
}
return
hasContent
},
_startCheckTimer
()
{
this
.
_clearCheckTimer
()
this
.
_checkTimer
=
setInterval
(()
=>
{
this
.
_checkTimerCount
++
if
(
this
.
_checkTimerCount
>=
CHECK_RENDER_RETRY
)
{
this
.
_clearCheckTimer
()
this
.
_renderNext
()
return
}
if
(
this
.
_checkRender
())
{
this
.
_clearCheckTimer
()
}
},
CHECK_RENDER_DELAY
)
},
_clearCheckTimer
()
{
this
.
_checkTimerCount
=
0
if
(
this
.
_checkTimer
!=
null
)
{
window
.
clearInterval
(
this
.
_checkTimer
)
this
.
_checkTimer
=
null
}
},
_report
(
type
)
{
var
taskId
=
''
if
(
this
.
_pl
.
length
>
0
&&
this
.
_pi
<
this
.
_pl
.
length
)
{
var
data
=
this
.
_pd
[
this
.
_pl
[
this
.
_pi
]]
if
(
data
)
{
taskId
=
data
.
task_id
}
}
AdReport
.
instance
.
get
({
h
:
__uniConfig
.
compilerVersion
,
a
:
this
.
adpid
,
t
:
taskId
,
at
:
type
})
},
_randomId
()
{
var
result
=
''
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
result
+=
(
65536
*
(
1
+
Math
.
random
())
|
0
).
toString
(
16
).
substring
(
1
)
}
return
result
}
}
}
</
script
>
<
style
>
uni-ad
{
display
:
block
;
overflow
:
hidden
;
}
uni-ad
[
hidden
]
{
display
:
none
;
}
</
style
>
packages/uni-h5/src/view/components/cover-image/index.vue
0 → 100644
浏览文件 @
313f1354
<
template
>
<uni-cover-image
:src=
"src"
v-on=
"$listeners"
>
<div
class=
"uni-cover-image"
>
<img
v-if=
"src"
:src=
"$getRealPath(src)"
@
load=
"_load"
@
error=
"_error"
>
</div>
</uni-cover-image>
</
template
>
<
script
>
export
default
{
name
:
'
CoverImage
'
,
props
:
{
src
:
{
type
:
String
,
default
:
''
}
},
methods
:
{
_load
(
$event
)
{
this
.
$trigger
(
'
load
'
,
$event
)
},
_error
(
$event
)
{
this
.
$trigger
(
'
error
'
,
$event
)
}
}
}
</
script
>
<
style
>
uni-cover-image
{
display
:
block
;
line-height
:
1.2
;
overflow
:
hidden
;
height
:
100%
;
width
:
100%
;
pointer-events
:
auto
;
}
uni-cover-image
img
{
width
:
100%
;
height
:
100%
;
}
uni-cover-image
[
hidden
]
{
display
:
none
;
}
uni-cover-image
.uni-cover-image
{
width
:
100%
;
height
:
100%
;
text-overflow
:
inherit
;
overflow
:
inherit
;
white-space
:
nowrap
;
-webkit-align-items
:
inherit
;
align-items
:
inherit
;
-webkit-justify-content
:
inherit
;
justify-content
:
inherit
;
-webkit-flex-direction
:
inherit
;
flex-direction
:
inherit
;
font-size
:
0
;
display
:
inherit
;
}
</
style
>
packages/uni-h5/src/view/components/cover-view/index.vue
0 → 100644
浏览文件 @
313f1354
<
template
>
<uni-cover-view
:scroll-top=
"scrollTop"
v-on=
"$listeners"
>
<div
ref=
"content"
class=
"uni-cover-view"
>
<slot
/>
</div>
</uni-cover-view>
</
template
>
<
script
>
export
default
{
name
:
'
CoverView
'
,
props
:
{
scrollTop
:
{
type
:
[
String
,
Number
],
default
:
0
}
},
watch
:
{
scrollTop
(
val
)
{
this
.
setScrollTop
(
val
)
}
},
mounted
()
{
this
.
setScrollTop
(
this
.
scrollTop
)
},
methods
:
{
setScrollTop
(
val
)
{
var
content
=
this
.
$refs
.
content
if
(
getComputedStyle
(
content
).
overflowY
===
'
scroll
'
)
{
content
.
scrollTop
=
this
.
_upx2pxNum
(
val
)
}
},
_upx2pxNum
(
val
)
{
if
(
/
\d
+
[
ur
]
px$/i
.
test
(
val
))
{
val
.
replace
(
/
\d
+
[
ur
]
px$/i
,
text
=>
{
return
uni
.
upx2px
(
parseFloat
(
text
))
})
}
return
parseFloat
(
val
)
||
0
}
}
}
</
script
>
<
style
>
uni-cover-view
{
display
:
block
;
line-height
:
1.2
;
overflow
:
hidden
;
white-space
:
nowrap
;
pointer-events
:
auto
;
}
uni-cover-view
[
hidden
]
{
display
:
none
;
}
uni-cover-view
.uni-cover-view
{
width
:
100%
;
height
:
100%
;
text-overflow
:
inherit
;
overflow
:
hidden
;
white-space
:
inherit
;
-webkit-align-items
:
inherit
;
align-items
:
inherit
;
-webkit-justify-content
:
inherit
;
justify-content
:
inherit
;
-webkit-flex-direction
:
inherit
;
flex-direction
:
inherit
;
-webkit-flex-wrap
:
inherit
;
flex-wrap
:
inherit
;
display
:
inherit
;
overflow
:
inherit
;
}
</
style
>
packages/uni-h5/src/view/components/map/index.vue
0 → 100644
浏览文件 @
313f1354
此差异已折叠。
点击以展开。
packages/uni-h5/src/view/components/picker/index.vue
0 → 100644
浏览文件 @
313f1354
此差异已折叠。
点击以展开。
packages/uni-h5/src/view/components/video/index.vue
0 → 100644
浏览文件 @
313f1354
此差异已折叠。
点击以展开。
packages/uni-h5/src/view/components/web-view/README.md
0 → 100644
浏览文件 @
313f1354
# web-view
|属性|完成度|
|:-|:-|
|src|√|
|@message|-|
|方法|完成度|
|:-|:-|
|navigateTo|√|
|redirectTo|√|
|reLaunch|√|
|switchTab|√|
|navigateBack|√|
|getEnv|√|
|postMessage|-|
packages/uni-h5/src/view/components/web-view/index.vue
0 → 100644
浏览文件 @
313f1354
<
template
>
<uni-web-view
v-on=
"$listeners"
>
<v-uni-resize-sensor
ref=
"sensor"
@
resize=
"_resize"
/>
</uni-web-view>
</
template
>
<
script
>
export
default
{
name
:
'
WebView
'
,
props
:
{
src
:
{
type
:
String
,
default
:
''
}
},
watch
:
{
src
(
val
,
oldVal
)
{
this
.
iframe
&&
(
this
.
iframe
.
src
=
this
.
$getRealPath
(
this
.
src
))
}
},
mounted
()
{
this
.
iframe
=
document
.
createElement
(
'
iframe
'
)
Object
.
keys
(
this
.
$attrs
).
forEach
(
key
=>
{
this
.
iframe
[
key
]
=
this
.
$attrs
[
key
]
})
this
.
iframe
.
src
=
this
.
$getRealPath
(
this
.
src
)
document
.
body
.
appendChild
(
this
.
iframe
)
this
.
_resize
()
},
activated
()
{
this
.
iframe
.
style
.
display
=
'
block
'
},
deactivated
()
{
this
.
iframe
.
style
.
display
=
'
none
'
},
beforeDestroy
()
{
document
.
body
.
removeChild
(
this
.
iframe
)
},
methods
:
{
_resize
()
{
const
{
top
,
left
,
width
,
height
}
=
this
.
$el
.
getBoundingClientRect
()
this
.
iframe
.
style
.
position
=
'
absolute
'
this
.
iframe
.
style
.
display
=
'
block
'
this
.
iframe
.
style
.
border
=
0
this
.
iframe
.
style
.
top
=
top
+
'
px
'
this
.
iframe
.
style
.
left
=
left
+
'
px
'
this
.
iframe
.
style
.
width
=
width
+
'
px
'
this
.
iframe
.
style
.
height
=
height
+
'
px
'
}
}
}
</
script
>
<
style
>
uni-web-view
{
position
:
absolute
;
left
:
0
;
right
:
0
;
top
:
0
;
bottom
:
0
;
}
</
style
>
tsconfig.json
浏览文件 @
313f1354
...
...
@@ -6,7 +6,7 @@
"target"
:
"esnext"
,
"module"
:
"esnext"
,
"moduleResolution"
:
"node"
,
"allowJs"
:
fals
e
,
"allowJs"
:
tru
e
,
"strict"
:
true
,
"noUnusedLocals"
:
true
,
"experimentalDecorators"
:
true
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录