Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
anyefeiyu
uni-app
提交
9e09cee1
U
uni-app
项目概览
anyefeiyu
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e09cee1
编写于
5月 29, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
2cef0c9a
3d0a248f
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
96 addition
and
31 deletion
+96
-31
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
+1
-1
packages/webpack-uni-mp-loader/__tests__/components.spec.js
packages/webpack-uni-mp-loader/__tests__/components.spec.js
+32
-1
packages/webpack-uni-mp-loader/lib/babel/scoped-component-traverse.js
...pack-uni-mp-loader/lib/babel/scoped-component-traverse.js
+5
-4
packages/webpack-uni-mp-loader/lib/plugin/generate-component.js
...es/webpack-uni-mp-loader/lib/plugin/generate-component.js
+35
-0
packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/index.js
...-uni-pages-loader/lib/platforms/quickapp-webview/index.js
+1
-1
packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/project.config.json
...loader/lib/platforms/quickapp-webview/project.config.json
+1
-1
src/core/helpers/hidpi.js
src/core/helpers/hidpi.js
+9
-18
src/core/view/components/canvas/index.vue
src/core/view/components/canvas/index.vue
+1
-1
src/platforms/app-plus/service/framework/webview/index.js
src/platforms/app-plus/service/framework/webview/index.js
+3
-1
src/platforms/app-plus/view/components/video/index.vue
src/platforms/app-plus/view/components/video/index.vue
+2
-1
src/platforms/mp-alipay/runtime/api/protocols.js
src/platforms/mp-alipay/runtime/api/protocols.js
+6
-2
未找到文件。
packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
浏览文件 @
9e09cee1
此差异已折叠。
点击以展开。
packages/webpack-uni-mp-loader/__tests__/components.spec.js
浏览文件 @
9e09cee1
...
...
@@ -122,6 +122,37 @@ global['__wxVueOptions'] = {
source
:
'
../icon/loading.vue
'
}
])
assertCodegen
(
`import myButton from '@/components/my-button/my-button.vue';
export default {
components: {
myButton
}
}
import VanButton from '../button/index.vue'
import VanSearch from '../search/index.vue'
exports.default.components = Object.assign({
'van-button': VanButton,
'van-search': VanSearch,
},exports.default.components || {})`
,
[
{
name
:
'
van-button
'
,
value
:
'
VanButton
'
,
source
:
'
../button/index.vue
'
},
{
name
:
'
van-search
'
,
value
:
'
VanSearch
'
,
source
:
'
../search/index.vue
'
},
{
name
:
'
myButton
'
,
value
:
'
myButton
'
,
source
:
'
@/components/my-button/my-button.vue
'
}
])
})
it
(
'
parse global component
'
,
()
=>
{
...
...
@@ -147,4 +178,4 @@ global['__wxVueOptions'] = {
source
:
'
@/components/tab-nvue/mediaList.vue
'
}],
false
)
})
})
})
packages/webpack-uni-mp-loader/lib/babel/scoped-component-traverse.js
浏览文件 @
9e09cee1
...
...
@@ -34,15 +34,16 @@ function handleObjectExpression (declaration, path, state) {
}
}
function
handleComponentsObjectExpression
(
componentsObjExpr
,
path
,
state
)
{
function
handleComponentsObjectExpression
(
componentsObjExpr
,
path
,
state
,
prepend
)
{
const
properties
=
componentsObjExpr
.
properties
.
filter
(
prop
=>
t
.
isObjectProperty
(
prop
)
&&
t
.
isIdentifier
(
prop
.
value
))
state
.
components
=
parseComponents
(
properties
.
map
(
prop
=>
{
const
components
=
parseComponents
(
properties
.
map
(
prop
=>
{
return
{
name
:
prop
.
key
.
name
||
prop
.
key
.
value
,
value
:
prop
.
value
.
name
}
}),
path
.
scope
.
bindings
,
path
)
state
.
components
=
prepend
?
components
.
concat
(
state
.
components
)
:
components
}
module
.
exports
=
function
(
ast
,
state
=
{
...
...
@@ -74,7 +75,7 @@ module.exports = function (ast, state = {
rightExpression
.
arguments
.
length
===
2
&&
t
.
isObjectExpression
(
rightExpression
.
arguments
[
0
])
)
{
handleComponentsObjectExpression
(
rightExpression
.
arguments
[
0
],
path
,
state
)
handleComponentsObjectExpression
(
rightExpression
.
arguments
[
0
],
path
,
state
,
true
)
}
},
ExportDefaultDeclaration
(
path
)
{
...
...
@@ -105,4 +106,4 @@ module.exports = function (ast, state = {
ast
,
state
}
}
}
packages/webpack-uni-mp-loader/lib/plugin/generate-component.js
浏览文件 @
9e09cee1
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
{
removeExt
,
...
...
@@ -50,8 +51,10 @@ function findComponentModuleId (modules, concatenatedModules, resource, altResou
resource
}
let
lastComponents
=
[]
// TODO 解决方案不太理想
module
.
exports
=
function
generateComponent
(
compilation
)
{
const
curComponents
=
[]
const
components
=
getComponentSet
()
if
(
components
.
size
)
{
const
assets
=
compilation
.
assets
...
...
@@ -62,6 +65,7 @@ module.exports = function generateComponent (compilation) {
Object
.
keys
(
assets
).
forEach
(
name
=>
{
if
(
components
.
has
(
name
.
replace
(
'
.js
'
,
''
)))
{
curComponents
.
push
(
name
.
replace
(
'
.js
'
,
''
))
const
chunkName
=
name
.
replace
(
'
.js
'
,
'
-create-component
'
)
let
moduleId
=
''
...
...
@@ -107,4 +111,35 @@ module.exports = function generateComponent (compilation) {
}
})
}
if
(
process
.
env
.
UNI_FEATURE_OBSOLETE
!==
false
)
{
if
(
lastComponents
.
length
)
{
for
(
const
name
of
lastComponents
)
{
if
(
!
curComponents
.
includes
(
name
))
{
removeUnusedComponent
(
name
)
// 组件被移除
}
}
}
for
(
const
name
of
curComponents
)
{
if
(
!
lastComponents
.
includes
(
name
))
{
addComponent
(
name
)
// 新增组件
}
}
lastComponents
=
curComponents
}
}
function
addComponent
(
name
)
{
const
bakJson
=
path
.
join
(
process
.
env
.
UNI_OUTPUT_DIR
,
name
+
'
.bak.json
'
)
if
(
fs
.
existsSync
(
bakJson
))
{
try
{
fs
.
renameSync
(
bakJson
,
path
.
join
(
process
.
env
.
UNI_OUTPUT_DIR
,
name
+
'
.json
'
))
}
catch
(
e
)
{}
}
}
function
removeUnusedComponent
(
name
)
{
try
{
fs
.
renameSync
(
path
.
join
(
process
.
env
.
UNI_OUTPUT_DIR
,
name
+
'
.json
'
),
path
.
join
(
process
.
env
.
UNI_OUTPUT_DIR
,
name
+
'
.bak.json
'
))
}
catch
(
e
)
{}
}
packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/index.js
浏览文件 @
9e09cee1
...
...
@@ -10,7 +10,7 @@ module.exports = function (pagesJson, manifestJson) {
}
=
require
(
'
../mp
'
)(
pagesJson
,
manifestJson
,
require
(
'
./project.config.json
'
))
const
baseJson
=
{
minPlatformVersion
:
10
53
minPlatformVersion
:
10
70
}
manifestJson
.
name
&&
(
baseJson
.
name
=
manifestJson
.
name
)
manifestJson
.
versionName
&&
(
baseJson
.
versionName
=
manifestJson
.
versionName
)
...
...
packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/project.config.json
浏览文件 @
9e09cee1
...
...
@@ -14,7 +14,7 @@
"libVersion"
:
""
,
"appid"
:
"touristappid"
,
"projectname"
:
""
,
"quickappRoot"
:
""
,
"quickappRoot"
:
"
./
"
,
"condition"
:
{
"search"
:
{
"current"
:
-1
,
...
...
src/core/helpers/hidpi.js
浏览文件 @
9e09cee1
...
...
@@ -106,8 +106,9 @@ if (pixelRatio !== 1) {
args
[
1
]
*=
pixelRatio
args
[
2
]
*=
pixelRatio
this
.
font
=
this
.
font
.
replace
(
/
(\d
+
)(
px|em|rem|pt
)
/g
,
var
font
=
this
.
font
this
.
font
=
font
.
replace
(
/
(\d
+
\.?\d
*
)(
px|em|rem|pt
)
/g
,
function
(
w
,
m
,
u
)
{
return
(
m
*
pixelRatio
)
+
u
}
...
...
@@ -115,12 +116,7 @@ if (pixelRatio !== 1) {
_super
.
apply
(
this
,
args
)
this
.
font
=
this
.
font
.
replace
(
/
(\d
+
)(
px|em|rem|pt
)
/g
,
function
(
w
,
m
,
u
)
{
return
(
m
/
pixelRatio
)
+
u
}
)
this
.
font
=
font
}
})(
proto
.
fillText
)
...
...
@@ -134,21 +130,16 @@ if (pixelRatio !== 1) {
args
[
1
]
*=
pixelRatio
// x
args
[
2
]
*=
pixelRatio
// y
this
.
font
=
this
.
font
.
replace
(
/
(\d
+
)(
px|em|rem|pt
)
/g
,
var
font
=
this
.
font
this
.
font
=
font
.
replace
(
/
(\d
+
\.?\d
*
)(
px|em|rem|pt
)
/g
,
function
(
w
,
m
,
u
)
{
return
(
m
*
pixelRatio
)
+
u
}
)
_super
.
apply
(
this
,
args
)
this
.
font
=
this
.
font
.
replace
(
/
(\d
+
)(
px|em|rem|pt
)
/g
,
function
(
w
,
m
,
u
)
{
return
(
m
/
pixelRatio
)
+
u
}
)
this
.
font
=
font
}
})(
proto
.
strokeText
)
...
...
@@ -168,4 +159,4 @@ export function wrapper (canvas) {
canvas
.
width
=
canvas
.
offsetWidth
*
pixelRatio
canvas
.
height
=
canvas
.
offsetHeight
*
pixelRatio
canvas
.
getContext
(
'
2d
'
).
__hidpi__
=
true
}
}
src/core/view/components/canvas/index.vue
浏览文件 @
9e09cee1
...
...
@@ -360,7 +360,7 @@ export default {
}
else
{
// 解决 PLUS-APP(wkwebview)以及 H5 图像跨域问题(H5图像响应头需包含access-control-allow-origin)
if
(
window
.
plus
&&
src
.
indexOf
(
'
http://
'
)
!==
0
&&
src
.
indexOf
(
'
https://
'
)
!==
0
)
{
0
&&
!
/^data:.*,.*/
.
test
(
src
)
)
{
loadFile
(
src
)
}
else
if
(
/^data:.*,.*/
.
test
(
src
))
{
self
.
_images
[
src
].
src
=
src
...
...
src/platforms/app-plus/service/framework/webview/index.js
浏览文件 @
9e09cee1
...
...
@@ -80,7 +80,9 @@ export function createWebview (path, routeOptions, query) {
webviewStyle
.
uniPageUrl
=
getUniPageUrl
(
path
,
query
)
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
[uni-app] createWebview
'
,
webviewId
,
path
,
webviewStyle
)
}
}
// android 需要使用
webviewStyle
.
isTab
=
!!
routeOptions
.
meta
.
isTabBar
return
plus
.
webview
.
create
(
''
,
String
(
webviewId
),
webviewStyle
,
{
nvue
:
true
})
...
...
src/platforms/app-plus/view/components/video/index.vue
浏览文件 @
9e09cee1
...
...
@@ -17,7 +17,8 @@ import native from '../../mixins/native'
const
methods
=
[
'
play
'
,
'
pause
'
,
'
pause
'
,
'
stop
'
,
'
seek
'
,
'
sendDanmu
'
,
'
playbackRate
'
,
...
...
src/platforms/mp-alipay/runtime/api/protocols.js
浏览文件 @
9e09cee1
import
{
isPlainObject
}
from
'
uni-shared
'
// 不支持的 API 列表
const
todos
=
[
// 'getRecorderManager',
...
...
@@ -86,6 +89,7 @@ const protocols = { // 需要做转换的 API 列表
request
:
{
name
:
my
.
canIUse
(
'
request
'
)
?
'
request
'
:
'
httpRequest
'
,
args
(
fromArgs
)
{
const
method
=
fromArgs
.
method
||
'
GET
'
if
(
!
fromArgs
.
header
)
{
// 默认增加 header 参数,方便格式化 content-type
fromArgs
.
header
=
{}
}
...
...
@@ -103,8 +107,8 @@ const protocols = { // 需要做转换的 API 列表
}
},
data
(
data
)
{
// 钉钉
在content-type为application/json时,不会自动序列化
if
(
my
.
dd
&&
headers
[
'
content-type
'
].
indexOf
(
'
application/json
'
)
===
0
)
{
// 钉钉
小程序在content-type为application/json时需上传字符串形式data,使用my.dd在真机运行钉钉小程序时不能正确判断
if
(
my
.
canIUse
(
'
saveFileToDingTalk
'
)
&&
method
.
toUpperCase
()
===
'
POST
'
&&
headers
[
'
content-type
'
].
indexOf
(
'
application/json
'
)
===
0
&&
isPlainObject
(
data
)
)
{
return
{
name
:
'
data
'
,
value
:
JSON
.
stringify
(
data
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录