Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
7751d337
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
718
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,发现更多精彩内容 >>
提交
7751d337
编写于
5月 12, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://github.com/dcloudio/uni-app
into alpha
# Conflicts: # packages/uni-h5/dist/index.umd.min.js
上级
9d44f8c3
2c8d9d3a
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
153 addition
and
68 deletion
+153
-68
packages/uni-cli-shared/lib/pages.js
packages/uni-cli-shared/lib/pages.js
+5
-0
packages/uni-cli-shared/lib/url-loader.js
packages/uni-cli-shared/lib/url-loader.js
+0
-6
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-mp-weixin/lib/uni.compiler.js
packages/uni-mp-weixin/lib/uni.compiler.js
+7
-6
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
...ompiler/__tests__/compiler-app-plus-extra.service.spec.js
+1
-1
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
...ni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+28
-8
packages/uni-template-compiler/__tests__/demo.js
packages/uni-template-compiler/__tests__/demo.js
+14
-1
packages/uni-template-compiler/lib/asset-url.js
packages/uni-template-compiler/lib/asset-url.js
+9
-10
packages/vue-cli-plugin-uni/index.js
packages/vue-cli-plugin-uni/index.js
+7
-2
packages/vue-cli-plugin-uni/lib/app-plus/getUrl.js
packages/vue-cli-plugin-uni/lib/app-plus/getUrl.js
+33
-0
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+4
-3
src/core/service/plugins/index.js
src/core/service/plugins/index.js
+7
-2
src/platforms/app-plus/view/mixins/cover.js
src/platforms/app-plus/view/mixins/cover.js
+1
-1
src/platforms/h5/service/api/device/get-system-info.js
src/platforms/h5/service/api/device/get-system-info.js
+4
-2
src/platforms/h5/view/components/video/index.vue
src/platforms/h5/view/components/video/index.vue
+32
-25
未找到文件。
packages/uni-cli-shared/lib/pages.js
浏览文件 @
7751d337
...
@@ -68,6 +68,11 @@ function processPagesJson (pagesJson, loader = {
...
@@ -68,6 +68,11 @@ function processPagesJson (pagesJson, loader = {
console
.
error
(
`
${
pagesJsonJsFileName
}
必须导出 function`
)
console
.
error
(
`
${
pagesJsonJsFileName
}
必须导出 function`
)
}
}
}
}
// 将 subpackages 转换成 subPackages
if
(
pagesJson
.
subpackages
&&
!
pagesJson
.
subPackages
)
{
pagesJson
.
subPackages
=
pagesJson
.
subpackages
delete
pagesJson
.
subpackages
}
let
uniNVueEntryPagePath
let
uniNVueEntryPagePath
if
(
pagesJson
.
pages
&&
pagesJson
.
pages
.
length
)
{
// 如果首页是 nvue
if
(
pagesJson
.
pages
&&
pagesJson
.
pages
.
length
)
{
// 如果首页是 nvue
...
...
packages/uni-cli-shared/lib/url-loader.js
浏览文件 @
7751d337
...
@@ -10,12 +10,6 @@ const defaultOptions = {
...
@@ -10,12 +10,6 @@ const defaultOptions = {
loader
:
'
file-loader
'
,
loader
:
'
file-loader
'
,
options
:
{
options
:
{
publicPath
(
url
,
resourcePath
,
context
)
{
publicPath
(
url
,
resourcePath
,
context
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
&&
process
.
env
.
UNI_USING_V3
)
{
// app-plus v3 下路径不能以/开头
return
normalizePath
(
path
.
relative
(
process
.
env
.
UNI_INPUT_DIR
,
resourcePath
))
}
return
'
/
'
+
normalizePath
(
path
.
relative
(
process
.
env
.
UNI_INPUT_DIR
,
resourcePath
))
return
'
/
'
+
normalizePath
(
path
.
relative
(
process
.
env
.
UNI_INPUT_DIR
,
resourcePath
))
},
},
outputPath
(
url
,
resourcePath
,
context
)
{
outputPath
(
url
,
resourcePath
,
context
)
{
...
...
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
7751d337
此差异已折叠。
点击以展开。
packages/uni-mp-weixin/lib/uni.compiler.js
浏览文件 @
7751d337
...
@@ -46,14 +46,15 @@ module.exports = {
...
@@ -46,14 +46,15 @@ module.exports = {
if
(
!
state
.
scopedSlots
)
{
if
(
!
state
.
scopedSlots
)
{
state
.
scopedSlots
=
{}
state
.
scopedSlots
=
{}
}
}
let
componentName
=
`
${
ownerName
}
-
${
parentName
}
-
${
slotName
}
`
const
baseName
=
`
${
ownerName
}
-
${
parentName
}
-
${
slotName
}
`
if
(
!
hasOwn
(
state
.
scopedSlots
,
componentName
))
{
let
componentName
=
baseName
state
.
scopedSlots
[
componentName
]
=
0
if
(
!
hasOwn
(
state
.
scopedSlots
,
baseName
))
{
state
.
scopedSlots
[
baseName
]
=
0
}
}
if
(
state
.
scopedSlots
[
component
Name
])
{
if
(
state
.
scopedSlots
[
base
Name
])
{
componentName
=
componentName
+
state
.
scopedSlots
[
component
Name
]
componentName
=
baseName
+
state
.
scopedSlots
[
base
Name
]
}
}
state
.
scopedSlots
[
component
Name
]
++
state
.
scopedSlots
[
base
Name
]
++
parentNode
.
attr
[
'
generic:scoped-slots-
'
+
slotName
]
=
componentName
parentNode
.
attr
[
'
generic:scoped-slots-
'
+
slotName
]
=
componentName
if
(
!
parentNode
.
attr
.
generic
)
{
if
(
!
parentNode
.
attr
.
generic
)
{
parentNode
.
attr
.
generic
=
{}
parentNode
.
attr
.
generic
=
{}
...
...
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
浏览文件 @
7751d337
...
@@ -172,7 +172,7 @@ describe('codegen', () => {
...
@@ -172,7 +172,7 @@ describe('codegen', () => {
)
)
assertCodegen
(
assertCodegen
(
'
<image src="../static/logo.png"/>
'
,
'
<image src="../static/logo.png"/>
'
,
`with(this){return _c('image',{attrs:{"src":_$s(0,'a-src',
"/"+
require("../static/logo.png")),"_i":0}})}`
`with(this){return _c('image',{attrs:{"src":_$s(0,'a-src',require("../static/logo.png")),"_i":0}})}`
)
)
assertCodegen
(
assertCodegen
(
'
<image src="@/static/logo.png"/>
'
,
'
<image src="@/static/logo.png"/>
'
,
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
7751d337
...
@@ -16,7 +16,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
...
@@ -16,7 +16,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
renderCode
(
res
)
renderCode
(
res
)
}
else
{
}
else
{
expect
(
res
.
render
).
toBe
(
renderCode
)
expect
(
res
.
render
).
toBe
(
renderCode
)
}
}
}
}
describe
(
'
mp:compiler-mp-weixin
'
,
()
=>
{
describe
(
'
mp:compiler-mp-weixin
'
,
()
=>
{
...
@@ -72,7 +72,7 @@ describe('mp:compiler-mp-weixin', () => {
...
@@ -72,7 +72,7 @@ describe('mp:compiler-mp-weixin', () => {
})
})
it
(
'
generate scoped slot
'
,
()
=>
{
it
(
'
generate scoped slot
'
,
()
=>
{
assertCodegen
(
// TODO vue-id
assertCodegen
(
// TODO vue-id
'
<span><slot v-bind:user="user">{{ user.lastName }}</slot></span>
'
,
'
<span><slot v-bind:user="user">{{ user.lastName }}</slot></span>
'
,
'
<label class="_span"><block wx:if="{{$slots.default}}"><scoped-slots-default user="{{user}}" bind:__l="__l"></scoped-slots-default></block><block wx:else>{{user.lastName}}</block></label>
'
,
'
<label class="_span"><block wx:if="{{$slots.default}}"><scoped-slots-default user="{{user}}" bind:__l="__l"></scoped-slots-default></block><block wx:else>{{user.lastName}}</block></label>
'
,
function
(
res
)
{
function
(
res
)
{
...
@@ -86,11 +86,31 @@ describe('mp:compiler-mp-weixin', () => {
...
@@ -86,11 +86,31 @@ describe('mp:compiler-mp-weixin', () => {
expect
(
res
.
componentGenerics
[
'
scoped-slots-header
'
]).
toBe
(
true
)
expect
(
res
.
componentGenerics
[
'
scoped-slots-header
'
]).
toBe
(
true
)
}
}
)
)
})
})
it
(
'
generate page-meta
'
,
()
=>
{
it
(
'
generate page-meta
'
,
()
=>
{
assertCodegen
(
// TODO vue-id
assertCodegen
(
// TODO vue-id
'
<view><page-meta/><view><button></button></view></view>
'
,
'
<view><page-meta/><view><button></button></view></view>
'
,
'
<page-meta vue-id="551070e6-1" bind:__l="__l"></page-meta><view><button></button></view>
'
'
<page-meta vue-id="551070e6-1" bind:__l="__l"></page-meta><view><button></button></view>
'
)
)
})
it
(
'
generate v-slot
'
,
()
=>
{
assertCodegen
(
`<view>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view class="red">{{label}}</view>
</slot-comp>
</view>`
,
'
<view><slot-comp generic:scoped-slots-test="test-slot-comp-test" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
test
\'
]}}"></slot-comp><slot-comp generic:scoped-slots-test="test-slot-comp-test1" vue-id="551070e6-2" bind:__l="__l" vue-slots="{{[
\'
test
\'
]}}"></slot-comp><slot-comp generic:scoped-slots-test="test-slot-comp-test2" vue-id="551070e6-3" bind:__l="__l" vue-slots="{{[
\'
test
\'
]}}"></slot-comp><slot-comp generic:scoped-slots-test="test-slot-comp-test3" vue-id="551070e6-4" bind:__l="__l" vue-slots="{{[
\'
test
\'
]}}"></slot-comp></view>
'
)
})
})
})
})
packages/uni-template-compiler/__tests__/demo.js
浏览文件 @
7751d337
...
@@ -19,7 +19,20 @@ const scopedPath = path.resolve(__dirname, '../../')
...
@@ -19,7 +19,20 @@ const scopedPath = path.resolve(__dirname, '../../')
const
compiler
=
require
(
'
../lib
'
)
const
compiler
=
require
(
'
../lib
'
)
const
res
=
compiler
.
compile
(
const
res
=
compiler
.
compile
(
`
`
<video controls=""/>
<view>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view>{{label}}</view>
</slot-comp>
<slot-comp v-slot:test="{label}">
<view class="red">{{label}}</view>
</slot-comp>
</view>
`
,
{
`
,
{
miniprogram
:
true
,
miniprogram
:
true
,
resourcePath
:
'
/User/fxy/Documents/test.wxml
'
,
resourcePath
:
'
/User/fxy/Documents/test.wxml
'
,
...
...
packages/uni-template-compiler/lib/asset-url.js
浏览文件 @
7751d337
...
@@ -43,14 +43,14 @@ function urlToRequire (url) {
...
@@ -43,14 +43,14 @@ function urlToRequire (url) {
* @param urlString an url as a string
* @param urlString an url as a string
*/
*/
function
parseUriParts
(
urlString
)
{
function
parseUriParts
(
urlString
)
{
// initialize return value
// initialize return value
/* eslint-disable node/no-deprecated-api */
/* eslint-disable node/no-deprecated-api */
const
returnValue
=
url
.
parse
(
''
)
const
returnValue
=
url
.
parse
(
''
)
if
(
urlString
)
{
if
(
urlString
)
{
// A TypeError is thrown if urlString is not a string
// A TypeError is thrown if urlString is not a string
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
if
(
typeof
urlString
===
'
string
'
)
{
if
(
typeof
urlString
===
'
string
'
)
{
// check is an uri
// check is an uri
/* eslint-disable node/no-deprecated-api */
/* eslint-disable node/no-deprecated-api */
return
url
.
parse
(
urlString
)
// take apart the uri
return
url
.
parse
(
urlString
)
// take apart the uri
}
}
...
@@ -72,14 +72,13 @@ function rewrite (attr, name, options) {
...
@@ -72,14 +72,13 @@ function rewrite (attr, name, options) {
const
needRequire
=
options
.
service
||
options
.
view
||
options
.
h5
const
needRequire
=
options
.
service
||
options
.
view
||
options
.
h5
if
(
needRequire
)
{
if
(
needRequire
)
{
attr
.
value
=
urlToRequire
(
attr
.
value
.
slice
(
1
,
-
1
))
attr
.
value
=
urlToRequire
(
attr
.
value
.
slice
(
1
,
-
1
))
if
(
attr
.
value
.
startsWith
(
'
require("
'
))
{
// require
if
(
// v3 需要增加前缀 /
options
.
h5
&&
if
(
options
.
service
||
options
.
view
)
{
options
.
publicPath
===
'
./
'
&&
attr
.
value
=
`"/"+
${
attr
.
value
}
`
attr
.
value
.
startsWith
(
'
require("
'
)
}
else
if
(
options
.
h5
&&
options
.
publicPath
===
'
./
'
)
{
)
{
// require
// h5 且 publicPath 为 ./ (仅生产模式可能为./)
// h5 且 publicPath 为 ./ (仅生产模式可能为./)
attr
.
value
=
`(
${
attr
.
value
}
).substr(1)`
attr
.
value
=
`(
${
attr
.
value
}
).substr(1)`
}
}
}
}
}
return
true
return
true
...
...
packages/vue-cli-plugin-uni/index.js
浏览文件 @
7751d337
...
@@ -53,8 +53,13 @@ module.exports = (api, options) => {
...
@@ -53,8 +53,13 @@ module.exports = (api, options) => {
vueConfig
=
vueConfig
(
options
,
api
)
vueConfig
=
vueConfig
(
options
,
api
)
}
}
if
(
options
.
pages
)
{
// 允许 vue.config.js pages 覆盖
if
(
options
.
pages
)
{
delete
vueConfig
.
pages
// h5平台 允许 vue.config.js pages 覆盖,其他平台移除 pages 配置
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
delete
vueConfig
.
pages
}
else
{
delete
options
.
pages
}
}
}
Object
.
assign
(
options
,
{
// TODO 考虑非 HBuilderX 运行时,可以支持自定义输出目录
Object
.
assign
(
options
,
{
// TODO 考虑非 HBuilderX 运行时,可以支持自定义输出目录
...
...
packages/vue-cli-plugin-uni/lib/app-plus/getUrl.js
0 → 100644
浏览文件 @
7751d337
'
use strict
'
module
.
exports
=
function
(
url
,
options
)
{
if
(
!
options
)
{
// eslint-disable-next-line no-param-reassign
options
=
{}
}
// eslint-disable-next-line no-underscore-dangle, no-param-reassign
url
=
url
&&
url
.
__esModule
?
url
.
default
:
url
if
(
typeof
url
!==
'
string
'
)
{
return
url
}
// If url is already wrapped in quotes, remove them
if
(
/^
[
'"
]
.*
[
'"
]
$/
.
test
(
url
))
{
// eslint-disable-next-line no-param-reassign
url
=
url
.
slice
(
1
,
-
1
)
}
if
(
options
.
hash
)
{
// eslint-disable-next-line no-param-reassign
url
+=
options
.
hash
}
// Should url be wrapped?
// See https://drafts.csswg.org/css-values-3/#urls
if
(
/
[
"'()
\t\n]
/
.
test
(
url
)
||
options
.
needQuotes
)
{
return
'
"
'
.
concat
(
url
.
replace
(
/"/g
,
'
\\
"
'
).
replace
(
/
\n
/g
,
'
\\
n
'
),
'
"
'
)
}
if
(
url
.
indexOf
(
'
/
'
)
===
0
)
{
return
url
.
substr
(
1
)
}
return
url
}
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
7751d337
...
@@ -2,8 +2,8 @@ const fs = require('fs')
...
@@ -2,8 +2,8 @@ const fs = require('fs')
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
const
mkdirp
=
require
(
'
mkdirp
'
)
const
mkdirp
=
require
(
'
mkdirp
'
)
const
loaderUtils
=
require
(
'
loader-utils
'
)
const
loaderUtils
=
require
(
'
loader-utils
'
)
require
(
'
./error-reporting
'
)
require
(
'
./error-reporting
'
)
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
...
@@ -335,7 +335,8 @@ moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/pa
...
@@ -335,7 +335,8 @@ moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/pa
// vue-loader
// vue-loader
moduleAlias
.
addAlias
(
'
vue-loader
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/vue-loader
'
)
moduleAlias
.
addAlias
(
'
vue-loader
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/vue-loader
'
)
if
(
process
.
env
.
UNI_USING_V3
&&
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
if
(
process
.
env
.
UNI_USING_V3
&&
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
moduleAlias
.
addAlias
(
'
../runtime/getUrl.js
'
,
'
@dcloudio/vue-cli-plugin-uni/lib/app-plus/getUrl.js
'
)
moduleAlias
.
addAlias
(
'
vue-style-loader
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/app-vue-style-loader
'
)
moduleAlias
.
addAlias
(
'
vue-style-loader
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/app-vue-style-loader
'
)
}
}
...
...
src/core/service/plugins/index.js
浏览文件 @
7751d337
...
@@ -59,7 +59,7 @@ function getLocation (base = '/') {
...
@@ -59,7 +59,7 @@ function getLocation (base = '/') {
export
default
{
export
default
{
install
(
Vue
,
{
install
(
Vue
,
{
routes
routes
}
=
{})
{
}
=
{})
{
if
(
if
(
__PLATFORM__
===
'
h5
'
&&
__PLATFORM__
===
'
h5
'
&&
Vue
.
config
.
devtools
&&
Vue
.
config
.
devtools
&&
...
@@ -73,7 +73,11 @@ export default {
...
@@ -73,7 +73,11 @@ export default {
initPolyfill
(
Vue
)
initPolyfill
(
Vue
)
lifecycleMixin
(
Vue
)
lifecycleMixin
(
Vue
)
/* eslint-disable no-undef */
if
(
typeof
__UNI_ROUTER_BASE__
!==
'
undefined
'
)
{
__uniConfig
.
router
.
base
=
__UNI_ROUTER_BASE__
}
const
minId
=
getMinId
(
routes
)
const
minId
=
getMinId
(
routes
)
const
router
=
new
VueRouter
({
const
router
=
new
VueRouter
({
id
:
minId
,
id
:
minId
,
...
@@ -107,6 +111,7 @@ export default {
...
@@ -107,6 +111,7 @@ export default {
// 需跨平台,根据用户配置 hash 或 history 来调用
// 需跨平台,根据用户配置 hash 或 history 来调用
const
entryRoute
=
router
.
match
(
__uniConfig
.
router
.
mode
===
'
history
'
?
getLocation
(
__uniConfig
.
router
.
base
)
const
entryRoute
=
router
.
match
(
__uniConfig
.
router
.
mode
===
'
history
'
?
getLocation
(
__uniConfig
.
router
.
base
)
:
getHash
())
:
getHash
())
if
(
entryRoute
.
meta
.
name
)
{
if
(
entryRoute
.
meta
.
name
)
{
if
(
entryRoute
.
meta
.
id
)
{
if
(
entryRoute
.
meta
.
id
)
{
keepAliveInclude
.
push
(
entryRoute
.
meta
.
name
+
'
-
'
+
entryRoute
.
meta
.
id
)
keepAliveInclude
.
push
(
entryRoute
.
meta
.
name
+
'
-
'
+
entryRoute
.
meta
.
id
)
...
...
src/platforms/app-plus/view/mixins/cover.js
浏览文件 @
7751d337
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
if
(
key
===
'
top
'
||
key
===
'
left
'
)
{
if
(
key
===
'
top
'
||
key
===
'
left
'
)
{
val
=
Math
.
max
(
valNumber
,
parentValNumber
)
+
'
px
'
val
=
Math
.
max
(
valNumber
,
parentValNumber
)
+
'
px
'
}
else
if
(
key
===
'
width
'
||
key
===
'
height
'
)
{
}
else
if
(
key
===
'
width
'
||
key
===
'
height
'
)
{
const
base
=
key
===
'
width
'
?
'
left
'
:
'
left
'
const
base
=
key
===
'
width
'
?
'
left
'
:
'
top
'
const
parentStart
=
parseFloat
(
this
.
_nativeParent
.
position
[
base
])
const
parentStart
=
parseFloat
(
this
.
_nativeParent
.
position
[
base
])
const
viewStart
=
parseFloat
(
this
.
position
[
base
])
const
viewStart
=
parseFloat
(
this
.
position
[
base
])
const
diff1
=
Math
.
max
(
parentStart
-
viewStart
,
0
)
const
diff1
=
Math
.
max
(
parentStart
-
viewStart
,
0
)
...
...
src/platforms/h5/service/api/device/get-system-info.js
浏览文件 @
7751d337
...
@@ -16,8 +16,10 @@ const isIOS = /iphone|ipad|ipod/i.test(ua)
...
@@ -16,8 +16,10 @@ const isIOS = /iphone|ipad|ipod/i.test(ua)
export
function
getSystemInfoSync
()
{
export
function
getSystemInfoSync
()
{
var
screen
=
window
.
screen
var
screen
=
window
.
screen
var
pixelRatio
=
window
.
devicePixelRatio
var
pixelRatio
=
window
.
devicePixelRatio
var
screenWidth
=
screen
.
width
// 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正
var
screenHeight
=
screen
.
height
var
landscape
=
Math
.
abs
(
window
.
orientation
)
===
90
var
screenWidth
=
Math
[
landscape
?
'
max
'
:
'
min
'
](
screen
.
width
,
screen
.
height
)
var
screenHeight
=
Math
[
landscape
?
'
min
'
:
'
max
'
](
screen
.
height
,
screen
.
width
)
var
windowWidth
=
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
var
windowWidth
=
Math
.
min
(
window
.
innerWidth
,
document
.
documentElement
.
clientWidth
,
screenWidth
)
var
windowHeight
=
window
.
innerHeight
var
windowHeight
=
window
.
innerHeight
var
language
=
navigator
.
language
var
language
=
navigator
.
language
...
...
src/platforms/h5/view/components/video/index.vue
浏览文件 @
7751d337
<
template
>
<
template
>
<uni-video
<uni-video
:id=
"id"
:id=
"id"
v-on=
"$listeners"
v-on=
"$listeners"
>
>
<div
<div
ref=
"container"
ref=
"container"
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
>
>
<video
<video
ref=
"video"
ref=
"video"
:style=
"
{o
pacity:!start?0.8:1,o
bjectFit:objectFit}"
:style=
"
{objectFit:objectFit}"
:muted="muted"
:muted="muted"
:loop="loop"
:loop="loop"
:src="srcSync"
:src="srcSync"
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<div
<div
v-show=
"controlsShow"
v-show=
"controlsShow"
class=
"uni-video-bar uni-video-bar-full"
class=
"uni-video-bar uni-video-bar-full"
@
click.stop
@
click.stop
>
>
<div
class=
"uni-video-controls"
>
<div
class=
"uni-video-controls"
>
<div
<div
...
@@ -51,8 +51,8 @@
...
@@ -51,8 +51,8 @@
class="uni-video-control-button"
class="uni-video-control-button"
@click.stop="trigger"
@click.stop="trigger"
/>
/>
<div
class=
"uni-video-current-time"
>
<div
class=
"uni-video-current-time"
>
{{
currentTime
|
time
}}
{{
currentTime
|
time
}}
</div>
</div>
<div
<div
ref=
"progress"
ref=
"progress"
...
@@ -62,19 +62,19 @@
...
@@ -62,19 +62,19 @@
<div
class=
"uni-video-progress"
>
<div
class=
"uni-video-progress"
>
<div
<div
:style=
"
{width:buffered+'%'}"
:style=
"
{width:buffered+'%'}"
class="uni-video-progress-buffered"
class="uni-video-progress-buffered"
/>
/>
<div
<div
ref=
"ball"
ref=
"ball"
:style=
"
{left:progress+'%'}"
:style=
"
{left:progress+'%'}"
class="uni-video-ball"
class="uni-video-ball"
>
>
<div
class=
"uni-video-inner"
/>
<div
class=
"uni-video-inner"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"uni-video-duration"
>
<div
class=
"uni-video-duration"
>
{{
(
duration
||
durationTime
)
|
time
}}
{{
(
duration
||
durationTime
)
|
time
}}
</div>
</div>
</div>
</div>
<div
<div
...
@@ -82,8 +82,8 @@
...
@@ -82,8 +82,8 @@
:class=
"
{'uni-video-danmu-button-active':enableDanmuSync}"
:class=
"
{'uni-video-danmu-button-active':enableDanmuSync}"
class="uni-video-danmu-button"
class="uni-video-danmu-button"
@click.stop="triggerDanmu"
@click.stop="triggerDanmu"
>
>
弹幕
弹幕
</div>
</div>
<div
<div
v-show=
"showFullscreenBtn"
v-show=
"showFullscreenBtn"
...
@@ -96,27 +96,27 @@
...
@@ -96,27 +96,27 @@
v-show=
"start&&enableDanmuSync"
v-show=
"start&&enableDanmuSync"
ref=
"danmu"
ref=
"danmu"
style=
"z-index: 0;"
style=
"z-index: 0;"
class=
"uni-video-danmu"
class=
"uni-video-danmu"
/>
/>
<div
<div
v-if=
"
!start
"
v-if=
"
centerPlayBtnShow
"
class=
"uni-video-cover"
class=
"uni-video-cover"
@
click.stop
@
click.stop
>
>
<div
<div
class=
"uni-video-cover-play-button"
class=
"uni-video-cover-play-button"
@
click.stop=
"play"
@
click.stop=
"play"
/>
/>
<p
class=
"uni-video-cover-duration"
>
<p
class=
"uni-video-cover-duration"
>
{{
(
duration
||
durationTime
)
|
time
}}
{{
(
duration
||
durationTime
)
|
time
}}
</p>
</p>
</div>
</div>
<div
<div
:class=
"
{'uni-video-toast-volume':gestureType==='volume'}"
:class=
"
{'uni-video-toast-volume':gestureType==='volume'}"
class="uni-video-toast"
class="uni-video-toast"
>
>
<div
class=
"uni-video-toast-title"
>
<div
class=
"uni-video-toast-title"
>
音量
音量
</div>
</div>
<svg
<svg
class=
"uni-video-toast-icon"
class=
"uni-video-toast-icon"
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
<div
class=
"uni-video-toast-value"
>
<div
class=
"uni-video-toast-value"
>
<div
<div
:style=
"
{width:volumeNew*100+'%'}"
:style=
"
{width:volumeNew*100+'%'}"
class="uni-video-toast-value-content"
class="uni-video-toast-value-content"
>
>
<div
class=
"uni-video-toast-volume-grids"
>
<div
class=
"uni-video-toast-volume-grids"
>
<div
<div
...
@@ -147,10 +147,10 @@
...
@@ -147,10 +147,10 @@
</div>
</div>
<div
<div
:class=
"
{'uni-video-toast-progress':gestureType=='progress'}"
:class=
"
{'uni-video-toast-progress':gestureType=='progress'}"
class="uni-video-toast"
class="uni-video-toast"
>
>
<div
class=
"uni-video-toast-title"
>
<div
class=
"uni-video-toast-title"
>
{{
currentTimeNew
|
time
}}
/
{{
durationTime
|
time
}}
{{
currentTimeNew
|
time
}}
/
{{
durationTime
|
time
}}
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -278,6 +278,10 @@ export default {
...
@@ -278,6 +278,10 @@ export default {
showPlayBtn
:
{
showPlayBtn
:
{
type
:
[
Boolean
,
String
],
type
:
[
Boolean
,
String
],
default
:
true
default
:
true
},
showCenterPlayBtn
:
{
type
:
[
Boolean
,
String
],
default
:
true
}
}
},
},
data
()
{
data
()
{
...
@@ -306,8 +310,11 @@ export default {
...
@@ -306,8 +310,11 @@ export default {
}
}
},
},
computed
:
{
computed
:
{
centerPlayBtnShow
()
{
return
this
.
showCenterPlayBtn
&&
!
this
.
start
},
controlsShow
()
{
controlsShow
()
{
return
this
.
start
&&
this
.
controls
&&
this
.
controlsVisible
return
!
this
.
centerPlayBtnShow
&&
this
.
controls
&&
this
.
controlsVisible
},
},
autoHideContorls
()
{
autoHideContorls
()
{
return
this
.
controlsShow
&&
this
.
playing
&&
!
this
.
controlsTouching
return
this
.
controlsShow
&&
this
.
playing
&&
!
this
.
controlsTouching
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录