Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
luomor
uni-app
提交
581eb15e
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,发现更多精彩内容 >>
提交
581eb15e
编写于
4月 27, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://github.com/dcloudio/uni-app
into alpha
上级
a5aeae1d
a4a36a8a
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
22 addition
and
13 deletion
+22
-13
packages/uni-app-plus/lib/uni.automator.js
packages/uni-app-plus/lib/uni.automator.js
+1
-1
packages/uni-automator/dist/index.js
packages/uni-automator/dist/index.js
+1
-1
packages/uni-cli-shared/lib/plugin.js
packages/uni-cli-shared/lib/plugin.js
+1
-0
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
+1
-1
packages/vue-cli-plugin-uni/packages/webpack-html-append-plugin/index.js
...i-plugin-uni/packages/webpack-html-append-plugin/index.js
+10
-6
packages/webpack-uni-pages-loader/lib/index-new.js
packages/webpack-uni-pages-loader/lib/index-new.js
+1
-1
packages/webpack-uni-pages-loader/lib/platforms/h5.js
packages/webpack-uni-pages-loader/lib/platforms/h5.js
+6
-2
src/platforms/app-plus/service/api/ui/popup.js
src/platforms/app-plus/service/api/ui/popup.js
+1
-1
未找到文件。
packages/uni-app-plus/lib/uni.automator.js
浏览文件 @
581eb15e
"
use strict
"
;
function
t
(
t
){
return
t
&&
"
object
"
==
typeof
t
&&
"
default
"
in
t
?
t
.
default
:
t
}
var
e
=
t
(
require
(
"
fs
"
)),
i
=
t
(
require
(
"
debug
"
)),
s
=
t
(
require
(
"
postcss-selector-parser
"
)),
a
=
require
(
"
path
"
),
r
=
require
(
"
util
"
),
n
=
t
(
require
(
"
licia/dateFormat
"
));
function
c
(
t
){
t
.
walk
(
t
=>
{
if
(
"
tag
"
===
t
.
type
){
const
e
=
t
.
value
;
t
.
value
=
"
page
"
===
e
?
"
body
"
:
"
uni-
"
+
e
}})}
const
o
=
[
"
Page.getElement
"
,
"
Page.getElements
"
,
"
Element.getElement
"
,
"
Element.getElements
"
];
const
l
=
require
(
"
adbkit
"
),
h
=
i
(
"
automator:adb
"
),
d
=
r
.
promisify
(
e
.
readdir
),
u
=
r
.
promisify
(
e
.
stat
);
class
p
{
constructor
(
t
){
this
.
device
=
{
id
:
""
},
this
.
device
.
id
=
t
.
id
,
this
.
apk
=
t
.
executablePath
,
this
.
appid
=
t
.
appid
||
"
HBuilder
"
,
this
.
package
=
t
.
package
||
"
io.dcloud.HBuilder
"
,
this
.
client
=
l
.
createClient
()}
async
init
(){
if
(
!
this
.
device
.
id
){
const
t
=
await
this
.
client
.
listDevices
();
if
(
!
t
.
length
)
throw
Error
(
"
Device id is not provided
"
);
this
.
device
.
id
=
t
[
0
].
id
}
this
.
sdcard
=
(
await
this
.
shell
(
this
.
COMMAND_EXTERNAL
)).
trim
(),
h
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
init
${
this
.
device
.
id
}
${
this
.
sdcard
}
`
)}
version
(){
return
this
.
shell
(
this
.
COMMAND_VERSION
).
then
(
t
=>
{
const
e
=
t
.
match
(
/versionName=
(
.*
)
/
);
return
e
&&
e
.
length
>
1
?
e
[
1
]:
""
})}
install
(){
return
h
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
install
${
this
.
apk
}
`
),
this
.
client
.
install
(
this
.
device
.
id
,
this
.
apk
).
then
(()
=>
this
.
init
())}
push
(
t
){
return
async
function
t
(
e
){
const
i
=
await
d
(
e
);
return
(
await
Promise
.
all
(
i
.
map
(
async
i
=>
{
const
s
=
a
.
resolve
(
e
,
i
);
return
(
await
u
(
s
)).
isDirectory
()?
t
(
s
):
s
}))).
reduce
((
t
,
e
)
=>
t
.
concat
(
e
),[])}(
t
).
then
(
e
=>
{
const
i
=
e
.
map
(
e
=>
{
const
i
=
a
.
join
(
this
.
DIR_WWW
,
a
.
relative
(
t
,
e
));
return
h
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
push
${
e
}
${
i
}
`
),
this
.
client
.
push
(
this
.
device
.
id
,
e
,
i
)});
return
Promise
.
all
(
i
)}).
then
(
t
=>!
0
)}
start
(){
return
this
.
exit
().
then
(()
=>
this
.
shell
(
this
.
COMMAND_START
))}
exit
(){
return
this
.
shell
(
this
.
COMMAND_STOP
)}
captureScreenshot
(){
return
this
.
client
.
screencap
(
this
.
device
.
id
).
then
(
t
=>
new
Promise
(
e
=>
{
const
i
=
[];
t
.
on
(
"
data
"
,(
function
(
t
){
i
.
push
(
t
)})),
t
.
on
(
"
end
"
,(
function
(){
e
(
Buffer
.
concat
(
i
).
toString
(
"
base64
"
))}))}))}
shouldPush
(){
return
this
.
client
.
stat
(
this
.
device
.
id
,
this
.
FILE_APP_SERVICE
).
then
(()
=>!
1
).
catch
(()
=>!
0
)}
shell
(
t
){
return
h
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
SEND ►
${
t
}
`
),
this
.
client
.
shell
(
this
.
device
.
id
,
t
).
then
(
l
.
util
.
readAll
).
then
(
t
=>
{
const
e
=
t
.
toString
();
return
h
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
◀ RECV
${
e
}
`
),
e
})}
get
DIR_WWW
(){
return
`
${
this
.
sdcard
}
/Android/data/
${
this
.
package
}
/apps/
${
this
.
appid
}
/www/`
}
get
FILE_APP_SERVICE
(){
return
`
${
this
.
sdcard
}
/Android/data/
${
this
.
package
}
/apps/
${
this
.
appid
}
/www/app-service.js`
}
get
COMMAND_EXTERNAL
(){
return
"
echo $EXTERNAL_STORAGE
"
}
get
COMMAND_VERSION
(){
return
"
dumpsys package
"
+
this
.
package
}
get
COMMAND_STOP
(){
return
"
am force-stop
"
+
this
.
package
}
get
COMMAND_START
(){
return
`am start -n
${
this
.
package
}
/io.dcloud.PandoraEntry --es
${
this
.
appid
}
--ez needUpdateApp false --ez reload true`
}}
const
m
=
i
(
"
automator:devtool
"
);
let
y
,
f
=!
1
;
const
g
=
{
"
Tool.close
"
:{
reflect
:
async
()
=>
{}},
"
App.exit
"
:{
reflect
:
async
()
=>
y
.
exit
()},
"
App.enableLog
"
:{
reflect
:()
=>
Promise
.
resolve
()},
"
App.captureScreenshot
"
:{
reflect
:
async
(
t
,
e
)
=>
{
const
i
=
await
y
.
captureScreenshot
(
e
);
return
m
(
"
App.captureScreenshot
"
+
i
.
length
),{
data
:
i
}}}};
!
function
(
t
){
o
.
forEach
(
e
=>
{
t
[
e
]
=
function
(
t
){
return
{
reflect
:
async
(
e
,
i
)
=>
e
(
t
,
i
,
!
1
),
params
:
t
=>
(
t
.
selector
&&
(
t
.
selector
=
s
(
c
).
processSync
(
t
.
selector
)),
t
)}}(
e
)})}(
g
);
const
v
=
{
devtools
:{
name
:
"
App
"
,
paths
:[],
required
:[
"
manifest.json
"
,
"
app-service.js
"
],
validate
:
async
function
(
t
,
i
){
if
(
t
.
platform
=
(
t
.
platform
||
process
.
env
.
UNI_OS_NAME
).
toLocaleLowerCase
(),
Object
.
assign
(
t
,
t
[
t
.
platform
]),
y
=
function
(
t
,
e
){
return
new
p
(
e
)}(
t
.
platform
,
t
),
await
y
.
init
(),
!
await
y
.
version
()){
if
(
!
t
.
executablePath
)
throw
Error
(
`app-plus->
${
t
.
platform
}
->executablePath is not provided`
);
if
(
!
e
.
existsSync
(
t
.
executablePath
))
throw
Error
(
t
.
executablePath
+
"
not exists
"
);
f
=!
0
}
return
t
},
create
:
async
function
(
t
,
e
,
i
){
f
&&
await
y
.
install
(),(
i
.
compiled
||
await
y
.
shouldPush
())
&&
await
y
.
push
(
t
),
await
y
.
start
()}},
adapter
:
g
};
module
.
exports
=
v
;
"
use strict
"
;
function
e
(
e
){
return
e
&&
"
object
"
==
typeof
e
&&
"
default
"
in
e
?
e
.
default
:
e
}
var
t
=
e
(
require
(
"
fs
"
)),
s
=
e
(
require
(
"
debug
"
)),
i
=
e
(
require
(
"
postcss-selector-parser
"
)),
r
=
require
(
"
path
"
),
a
=
require
(
"
util
"
),
n
=
e
(
require
(
"
licia/dateFormat
"
));
function
o
(
e
){
e
.
walk
(
e
=>
{
if
(
"
tag
"
===
e
.
type
){
const
t
=
e
.
value
;
e
.
value
=
"
page
"
===
t
?
"
body
"
:
"
uni-
"
+
t
}})}
const
c
=
[
"
Page.getElement
"
,
"
Page.getElements
"
,
"
Element.getElement
"
,
"
Element.getElements
"
];
class
l
{
constructor
(
e
){}
async
init
(){}
version
(){
return
Promise
.
resolve
(
"
9.6.93
"
)}
install
(){
return
Promise
.
resolve
(
!
0
)}
push
(
e
){
return
Promise
.
resolve
(
!
0
)}
start
(){
return
Promise
.
resolve
(
!
0
)}
exit
(){
return
Promise
.
resolve
(
!
0
)}
captureScreenshot
(){
return
Promise
.
resolve
(
""
)}
shouldPush
(){
return
Promise
.
resolve
(
!
1
)}}
const
h
=
require
(
"
adbkit
"
),
u
=
s
(
"
automator:adb
"
),
d
=
a
.
promisify
(
t
.
readdir
),
p
=
a
.
promisify
(
t
.
stat
);
class
m
{
constructor
(
e
){
this
.
device
=
{
id
:
""
},
this
.
device
.
id
=
e
.
id
,
this
.
apk
=
e
.
executablePath
,
this
.
appid
=
e
.
appid
||
"
HBuilder
"
,
this
.
package
=
e
.
package
||
"
io.dcloud.HBuilder
"
,
this
.
client
=
h
.
createClient
()}
async
init
(){
if
(
!
this
.
device
.
id
){
const
e
=
await
this
.
client
.
listDevices
();
if
(
!
e
.
length
)
throw
Error
(
"
Device id is not provided
"
);
this
.
device
.
id
=
e
[
0
].
id
}
this
.
sdcard
=
(
await
this
.
shell
(
this
.
COMMAND_EXTERNAL
)).
trim
(),
u
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
init
${
this
.
device
.
id
}
${
this
.
sdcard
}
`
)}
version
(){
return
this
.
shell
(
this
.
COMMAND_VERSION
).
then
(
e
=>
{
const
t
=
e
.
match
(
/versionName=
(
.*
)
/
);
return
t
&&
t
.
length
>
1
?
t
[
1
]:
""
})}
install
(){
return
u
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
install
${
this
.
apk
}
`
),
this
.
client
.
install
(
this
.
device
.
id
,
this
.
apk
).
then
(()
=>
this
.
init
())}
push
(
e
){
return
async
function
e
(
t
){
const
s
=
await
d
(
t
);
return
(
await
Promise
.
all
(
s
.
map
(
async
s
=>
{
const
i
=
r
.
resolve
(
t
,
s
);
return
(
await
p
(
i
)).
isDirectory
()?
e
(
i
):
i
}))).
reduce
((
e
,
t
)
=>
e
.
concat
(
t
),[])}(
e
).
then
(
t
=>
{
const
s
=
t
.
map
(
t
=>
{
const
s
=
r
.
join
(
this
.
DIR_WWW
,
r
.
relative
(
e
,
t
));
return
u
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
push
${
t
}
${
s
}
`
),
this
.
client
.
push
(
this
.
device
.
id
,
t
,
s
)});
return
Promise
.
all
(
s
)}).
then
(
e
=>!
0
)}
start
(){
return
this
.
exit
().
then
(()
=>
this
.
shell
(
this
.
COMMAND_START
))}
exit
(){
return
this
.
shell
(
this
.
COMMAND_STOP
)}
captureScreenshot
(){
return
this
.
client
.
screencap
(
this
.
device
.
id
).
then
(
e
=>
new
Promise
(
t
=>
{
const
s
=
[];
e
.
on
(
"
data
"
,(
function
(
e
){
s
.
push
(
e
)})),
e
.
on
(
"
end
"
,(
function
(){
t
(
Buffer
.
concat
(
s
).
toString
(
"
base64
"
))}))}))}
shouldPush
(){
return
this
.
client
.
stat
(
this
.
device
.
id
,
this
.
FILE_APP_SERVICE
).
then
(()
=>!
1
).
catch
(()
=>!
0
)}
shell
(
e
){
return
u
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
SEND ►
${
e
}
`
),
this
.
client
.
shell
(
this
.
device
.
id
,
e
).
then
(
h
.
util
.
readAll
).
then
(
e
=>
{
const
t
=
e
.
toString
();
return
u
(
`
${
n
(
"
yyyy-mm-dd HH:MM:ss:l
"
)}
◀ RECV
${
t
}
`
),
t
})}
get
DIR_WWW
(){
return
`
${
this
.
sdcard
}
/Android/data/
${
this
.
package
}
/apps/
${
this
.
appid
}
/www/`
}
get
FILE_APP_SERVICE
(){
return
`
${
this
.
sdcard
}
/Android/data/
${
this
.
package
}
/apps/
${
this
.
appid
}
/www/app-service.js`
}
get
COMMAND_EXTERNAL
(){
return
"
echo $EXTERNAL_STORAGE
"
}
get
COMMAND_VERSION
(){
return
"
dumpsys package
"
+
this
.
package
}
get
COMMAND_STOP
(){
return
"
am force-stop
"
+
this
.
package
}
get
COMMAND_START
(){
return
`am start -n
${
this
.
package
}
/io.dcloud.PandoraEntry --es
${
this
.
appid
}
--ez needUpdateApp false --ez reload true`
}}
const
y
=
s
(
"
automator:devtool
"
);
let
f
,
v
=!
1
;
const
g
=
{
"
Tool.close
"
:{
reflect
:
async
()
=>
{}},
"
App.exit
"
:{
reflect
:
async
()
=>
f
.
exit
()},
"
App.enableLog
"
:{
reflect
:()
=>
Promise
.
resolve
()},
"
App.captureScreenshot
"
:{
reflect
:
async
(
e
,
t
)
=>
{
const
s
=
await
f
.
captureScreenshot
(
t
);
return
y
(
"
App.captureScreenshot
"
+
s
.
length
),{
data
:
s
}}}};
!
function
(
e
){
c
.
forEach
(
t
=>
{
e
[
t
]
=
function
(
e
){
return
{
reflect
:
async
(
t
,
s
)
=>
t
(
e
,
s
,
!
1
),
params
:
e
=>
(
e
.
selector
&&
(
e
.
selector
=
i
(
o
).
processSync
(
e
.
selector
)),
e
)}}(
t
)})}(
g
);
const
E
=
{
devtools
:{
name
:
"
App
"
,
paths
:[],
required
:[
"
manifest.json
"
,
"
app-service.js
"
],
validate
:
async
function
(
e
,
s
){
if
(
e
.
platform
=
(
e
.
platform
||
process
.
env
.
UNI_OS_NAME
).
toLocaleLowerCase
(),
Object
.
assign
(
e
,
e
[
e
.
platform
]),
f
=
function
(
e
,
t
){
return
"
ios
"
===
e
?
new
l
(
t
):
new
m
(
t
)}(
e
.
platform
,
e
),
await
f
.
init
(),
!
await
f
.
version
()){
if
(
!
e
.
executablePath
)
throw
Error
(
`app-plus->
${
e
.
platform
}
->executablePath is not provided`
);
if
(
!
t
.
existsSync
(
e
.
executablePath
))
throw
Error
(
e
.
executablePath
+
"
not exists
"
);
v
=!
0
}
return
e
},
create
:
async
function
(
e
,
t
,
s
){
v
&&
await
f
.
install
(),(
s
.
compiled
||
await
f
.
shouldPush
())
&&
await
f
.
push
(
e
),
await
f
.
start
()}},
adapter
:
g
};
module
.
exports
=
E
;
packages/uni-automator/dist/index.js
浏览文件 @
581eb15e
此差异已折叠。
点击以展开。
packages/uni-cli-shared/lib/plugin.js
浏览文件 @
581eb15e
...
...
@@ -9,6 +9,7 @@ const Plugin = {
configureEnv
:
[],
// (){},
// 以 H5 为基准的平台特殊配置
configureH5
:
[],
// (h5Options) {},
configurePages
:
[],
// (pagesJson,manifestJson,loader) {},
// 链式修改 webpack config
chainWebpack
:
[],
// (config, vueOptions, api) {},
// 修改 webpack config
...
...
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
浏览文件 @
581eb15e
...
...
@@ -54,7 +54,7 @@ function getAssetsCopyOptions (assetsDir) {
function
getCopyWebpackPluginOptions
(
platformOptions
,
vueOptions
)
{
const
copyOptions
=
getAssetsCopyOptions
(
assetsDir
)
global
.
uniPlugin
.
copyWebpackOptions
.
forEach
(
copyWebpackOptions
=>
{
const
platformCopyOptions
=
copyWebpackOptions
(
platformOptions
,
vueOptions
)
||
[]
const
platformCopyOptions
=
copyWebpackOptions
(
platformOptions
,
vueOptions
,
copyOptions
)
||
[]
platformCopyOptions
.
forEach
(
copyOption
=>
{
if
(
typeof
copyOption
===
'
string
'
)
{
copyOption
=
getAssetsCopyOption
(
copyOption
)
...
...
packages/vue-cli-plugin-uni/packages/webpack-html-append-plugin/index.js
浏览文件 @
581eb15e
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
)
class
WebpackHtmlAppendPlugin
{
constructor
(
content
)
{
constructor
(
content
)
{
this
.
content
=
content
||
''
}
apply
(
compiler
)
{
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
'
WebpackHtmlAppendPlugin
'
,
(
compilation
)
=>
{
const
beforeEmit
=
compilation
.
hooks
.
htmlWebpackPluginAfterHtmlProcessing
||
HtmlWebpackPlugin
.
getHooks
(
compilation
).
beforeEmit
beforeEmit
.
tapAsync
(
'
WebpackHtmlAppendPlugin
'
,
(
data
,
cb
)
=>
{
let
beforeEmit
=
compilation
.
hooks
.
htmlWebpackPluginAfterHtmlProcessing
if
(
!
beforeEmit
&&
HtmlWebpackPlugin
.
getHooks
)
{
const
hooks
=
HtmlWebpackPlugin
.
getHooks
(
compilation
)
if
(
hooks
)
{
beforeEmit
=
hooks
.
beforeEmit
}
}
beforeEmit
&&
beforeEmit
.
tapAsync
(
'
WebpackHtmlAppendPlugin
'
,
(
data
,
cb
)
=>
{
data
.
html
+=
this
.
content
cb
(
null
,
data
)
})
...
...
packages/webpack-uni-pages-loader/lib/index-new.js
浏览文件 @
581eb15e
...
...
@@ -67,7 +67,7 @@ module.exports = function (content) {
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
)
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
,
this
)
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
quickapp-vue
'
)
{
return
require
(
'
./platforms/quickapp-vue
'
)(
pagesJson
,
manifestJson
,
this
)
...
...
packages/webpack-uni-pages-loader/lib/platforms/h5.js
浏览文件 @
581eb15e
...
...
@@ -327,9 +327,13 @@ meta:{
]
}
module
.
exports
=
function
(
pagesJson
,
manifestJson
)
{
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
loader
)
{
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
global
.
uniPlugin
.
configurePages
.
forEach
(
configurePages
=>
{
configurePages
(
pagesJson
,
manifestJson
,
loader
)
})
const
pageComponents
=
getPageComponents
(
inputDir
,
pagesJson
)
pagesJson
.
globalStyle
=
process
.
UNI_H5_PAGES_JSON
.
globalStyle
...
...
@@ -367,4 +371,4 @@ global.__uniConfig.nvue = ${JSON.stringify({ 'flex-direction': getFlexDirection(
${
genRegisterPageVueComponentsCode
(
pageComponents
)}
global.__uniRoutes=[
${
genPageRoutes
(
pageComponents
).
concat
(
genSystemRoutes
()).
join
(
'
,
'
)}
]
`
}
}
src/platforms/app-plus/service/api/ui/popup.js
浏览文件 @
581eb15e
...
...
@@ -128,7 +128,7 @@ export function hideToast () {
}
export
function
showModal
({
title
=
''
,
content
=
''
,
content
=
'
'
,
showCancel
=
true
,
cancelText
=
'
取消
'
,
cancelColor
=
'
#000000
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录