Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
luomor
uni-app
提交
7751d337
uni-app
项目概览
luomor
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
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 = {
console
.
error
(
`
${
pagesJsonJsFileName
}
必须导出 function`
)
}
}
// 将 subpackages 转换成 subPackages
if
(
pagesJson
.
subpackages
&&
!
pagesJson
.
subPackages
)
{
pagesJson
.
subPackages
=
pagesJson
.
subpackages
delete
pagesJson
.
subpackages
}
let
uniNVueEntryPagePath
if
(
pagesJson
.
pages
&&
pagesJson
.
pages
.
length
)
{
// 如果首页是 nvue
...
...
packages/uni-cli-shared/lib/url-loader.js
浏览文件 @
7751d337
...
...
@@ -10,12 +10,6 @@ const defaultOptions = {
loader
:
'
file-loader
'
,
options
:
{
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
))
},
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 = {
if
(
!
state
.
scopedSlots
)
{
state
.
scopedSlots
=
{}
}
let
componentName
=
`
${
ownerName
}
-
${
parentName
}
-
${
slotName
}
`
if
(
!
hasOwn
(
state
.
scopedSlots
,
componentName
))
{
state
.
scopedSlots
[
componentName
]
=
0
const
baseName
=
`
${
ownerName
}
-
${
parentName
}
-
${
slotName
}
`
let
componentName
=
baseName
if
(
!
hasOwn
(
state
.
scopedSlots
,
baseName
))
{
state
.
scopedSlots
[
baseName
]
=
0
}
if
(
state
.
scopedSlots
[
component
Name
])
{
componentName
=
componentName
+
state
.
scopedSlots
[
component
Name
]
if
(
state
.
scopedSlots
[
base
Name
])
{
componentName
=
baseName
+
state
.
scopedSlots
[
base
Name
]
}
state
.
scopedSlots
[
component
Name
]
++
state
.
scopedSlots
[
base
Name
]
++
parentNode
.
attr
[
'
generic:scoped-slots-
'
+
slotName
]
=
componentName
if
(
!
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', () => {
)
assertCodegen
(
'
<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
(
'
<image src="@/static/logo.png"/>
'
,
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
7751d337
...
...
@@ -72,7 +72,7 @@ describe('mp:compiler-mp-weixin', () => {
})
it
(
'
generate scoped slot
'
,
()
=>
{
assertCodegen
(
// TODO vue-id
assertCodegen
(
// TODO vue-id
'
<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>
'
,
function
(
res
)
{
...
...
@@ -88,9 +88,29 @@ describe('mp:compiler-mp-weixin', () => {
)
})
it
(
'
generate page-meta
'
,
()
=>
{
assertCodegen
(
// TODO vue-id
assertCodegen
(
// TODO vue-id
'
<view><page-meta/><view><button></button></view></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, '../../')
const
compiler
=
require
(
'
../lib
'
)
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
,
resourcePath
:
'
/User/fxy/Documents/test.wxml
'
,
...
...
packages/uni-template-compiler/lib/asset-url.js
浏览文件 @
7751d337
...
...
@@ -72,16 +72,15 @@ function rewrite (attr, name, options) {
const
needRequire
=
options
.
service
||
options
.
view
||
options
.
h5
if
(
needRequire
)
{
attr
.
value
=
urlToRequire
(
attr
.
value
.
slice
(
1
,
-
1
))
if
(
attr
.
value
.
startsWith
(
'
require("
'
))
{
// require
// v3 需要增加前缀 /
if
(
options
.
service
||
options
.
view
)
{
attr
.
value
=
`"/"+
${
attr
.
value
}
`
}
else
if
(
options
.
h5
&&
options
.
publicPath
===
'
./
'
)
{
if
(
options
.
h5
&&
options
.
publicPath
===
'
./
'
&&
attr
.
value
.
startsWith
(
'
require("
'
)
)
{
// require
// h5 且 publicPath 为 ./ (仅生产模式可能为./)
attr
.
value
=
`(
${
attr
.
value
}
).substr(1)`
}
}
}
return
true
}
}
...
...
packages/vue-cli-plugin-uni/index.js
浏览文件 @
7751d337
...
...
@@ -53,8 +53,13 @@ module.exports = (api, options) => {
vueConfig
=
vueConfig
(
options
,
api
)
}
if
(
options
.
pages
)
{
// 允许 vue.config.js pages 覆盖
if
(
options
.
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 运行时,可以支持自定义输出目录
...
...
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
...
...
@@ -336,6 +336,7 @@ moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/pa
moduleAlias
.
addAlias
(
'
vue-loader
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/vue-loader
'
)
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
'
)
}
...
...
src/core/service/plugins/index.js
浏览文件 @
7751d337
...
...
@@ -74,6 +74,10 @@ export default {
lifecycleMixin
(
Vue
)
/* eslint-disable no-undef */
if
(
typeof
__UNI_ROUTER_BASE__
!==
'
undefined
'
)
{
__uniConfig
.
router
.
base
=
__UNI_ROUTER_BASE__
}
const
minId
=
getMinId
(
routes
)
const
router
=
new
VueRouter
({
id
:
minId
,
...
...
@@ -107,6 +111,7 @@ export default {
// 需跨平台,根据用户配置 hash 或 history 来调用
const
entryRoute
=
router
.
match
(
__uniConfig
.
router
.
mode
===
'
history
'
?
getLocation
(
__uniConfig
.
router
.
base
)
:
getHash
())
if
(
entryRoute
.
meta
.
name
)
{
if
(
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 {
if
(
key
===
'
top
'
||
key
===
'
left
'
)
{
val
=
Math
.
max
(
valNumber
,
parentValNumber
)
+
'
px
'
}
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
viewStart
=
parseFloat
(
this
.
position
[
base
])
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)
export
function
getSystemInfoSync
()
{
var
screen
=
window
.
screen
var
pixelRatio
=
window
.
devicePixelRatio
var
screenWidth
=
screen
.
width
var
screenHeight
=
screen
.
height
// 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正
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
windowHeight
=
window
.
innerHeight
var
language
=
navigator
.
language
...
...
src/platforms/h5/view/components/video/index.vue
浏览文件 @
7751d337
...
...
@@ -15,7 +15,7 @@
>
<video
ref=
"video"
:style=
"
{o
pacity:!start?0.8:1,o
bjectFit:objectFit}"
:style=
"
{objectFit:objectFit}"
:muted="muted"
:loop="loop"
:src="srcSync"
...
...
@@ -99,7 +99,7 @@
class=
"uni-video-danmu"
/>
<div
v-if=
"
!start
"
v-if=
"
centerPlayBtnShow
"
class=
"uni-video-cover"
@
click.stop
>
...
...
@@ -278,6 +278,10 @@ export default {
showPlayBtn
:
{
type
:
[
Boolean
,
String
],
default
:
true
},
showCenterPlayBtn
:
{
type
:
[
Boolean
,
String
],
default
:
true
}
},
data
()
{
...
...
@@ -306,8 +310,11 @@ export default {
}
},
computed
:
{
centerPlayBtnShow
()
{
return
this
.
showCenterPlayBtn
&&
!
this
.
start
},
controlsShow
()
{
return
this
.
start
&&
this
.
controls
&&
this
.
controlsVisible
return
!
this
.
centerPlayBtnShow
&&
this
.
controls
&&
this
.
controlsVisible
},
autoHideContorls
()
{
return
this
.
controlsShow
&&
this
.
playing
&&
!
this
.
controlsTouching
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录