Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小浣熊撸代码
uni-app
提交
952982cc
U
uni-app
项目概览
小浣熊撸代码
/
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,发现更多精彩内容 >>
提交
952982cc
编写于
11月 09, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
05e8e781
951021ce
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
108 addition
and
28 deletion
+108
-28
packages/vue-cli-plugin-uni/commands/build.js
packages/vue-cli-plugin-uni/commands/build.js
+50
-8
src/platforms/h5/view/components/map/map-marker.js
src/platforms/h5/view/components/map/map-marker.js
+50
-17
src/platforms/h5/view/components/map/maps/callout.js
src/platforms/h5/view/components/map/maps/callout.js
+6
-1
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
+2
-2
未找到文件。
packages/vue-cli-plugin-uni/commands/build.js
浏览文件 @
952982cc
...
...
@@ -3,7 +3,9 @@ const path = require('path')
const
{
runByHBuilderX
,
isInHBuilderX
,
parseJson
parseJson
,
parsePagesJson
,
parseManifestJson
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
uniI18n
=
require
(
'
@dcloudio/uni-cli-i18n
'
)
...
...
@@ -32,7 +34,8 @@ module.exports = (api, options) => {
'
--auto-host
'
:
'
specify automator host
'
,
'
--auto-port
'
:
'
specify automator port
'
,
'
--subpackage
'
:
'
specify subpackage
'
,
'
--plugin
'
:
'
specify plugin
'
'
--plugin
'
:
'
specify plugin
'
,
'
--manifest
'
:
'
build manifest.json
'
}
},
async
(
args
)
=>
{
for
(
const
key
in
defaults
)
{
...
...
@@ -41,6 +44,10 @@ module.exports = (api, options) => {
}
}
if
(
args
.
manifest
&&
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
return
buildManifestJson
()
}
const
platforms
=
[
'
mp-weixin
'
,
'
mp-qq
'
,
'
mp-baidu
'
,
'
mp-alipay
'
,
'
mp-toutiao
'
,
'
mp-lark
'
]
if
(
args
.
subpackage
&&
platforms
.
includes
(
process
.
env
.
UNI_PLATFORM
))
{
process
.
env
.
UNI_SUBPACKGE
=
args
.
subpackage
...
...
@@ -135,7 +142,10 @@ async function build (args, api, options) {
log
()
if
(
!
runByHBuilderX
&&
!
runByAliIde
)
{
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
0
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
1
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
plugin
'
)
:
uniI18n
.
__
(
'
platform
'
)
}))
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
0
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
1
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
plugin
'
)
:
uniI18n
.
__
(
'
platform
'
)
}))
}
const
targetDir
=
api
.
resolve
(
options
.
outputDir
)
...
...
@@ -161,7 +171,8 @@ async function build (args, api, options) {
process
.
env
.
UNI_USING_V3_NATIVE
||
(
process
.
UNI_NVUE_ENTRY
&&
Object
.
keys
(
process
.
UNI_NVUE_ENTRY
).
length
)
)
{
webpackConfigs
.
push
(
require
(
'
@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
'
)(
process
.
UNI_NVUE_ENTRY
))
webpackConfigs
.
push
(
require
(
'
@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
'
)(
process
.
UNI_NVUE_ENTRY
))
}
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -178,7 +189,8 @@ async function build (args, api, options) {
return
reject
(
'
Build failed with errors.
'
)
}
if
(
!
args
.
silent
&&
(
process
.
env
.
UNI_PLATFORM
!==
'
app-plus
'
||
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
))
{
if
(
!
args
.
silent
&&
(
process
.
env
.
UNI_PLATFORM
!==
'
app-plus
'
||
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
))
{
const
targetDirShort
=
path
.
relative
(
api
.
service
.
context
,
process
.
env
.
UNI_OUTPUT_DIR
...
...
@@ -195,7 +207,8 @@ async function build (args, api, options) {
console
.
log
(
'
https://uniapp.dcloud.io/uniCloud/hosting
'
)
}
}
else
{
const
dirMsg
=
runByHBuilderX
?
''
:
`The
${
chalk
.
cyan
(
targetDirShort
)}
directory is ready. `
const
dirMsg
=
runByHBuilderX
?
''
:
`The
${
chalk
.
cyan
(
targetDirShort
)}
directory is ready. `
done
(
`Build complete.
${
dirMsg
}
Watching for changes...`
)
}
}
...
...
@@ -221,7 +234,9 @@ function analysisPluginDir () {
if
(
!
fs
.
pathExistsSync
(
pluginJsonPath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
0
:
pluginJsonName
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
0
:
pluginJsonName
}))
console
.
log
()
process
.
exit
(
0
)
}
...
...
@@ -235,8 +250,35 @@ function analysisPluginDir () {
if
(
UNI_MP_PLUGIN_MAIN
&&
!
fs
.
pathExistsSync
(
mainFilePath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
0
:
UNI_MP_PLUGIN_MAIN
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
0
:
UNI_MP_PLUGIN_MAIN
}))
console
.
log
()
process
.
exit
(
0
)
}
}
function
buildManifestJson
()
{
const
fs
=
require
(
'
fs-extra
'
)
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
const
outputDir
=
process
.
env
.
UNI_OUTPUT_DIR
const
pagesJsonPath
=
path
.
resolve
(
inputDir
,
'
pages.json
'
)
const
manifestJsonPath
=
path
.
resolve
(
inputDir
,
'
manifest.json
'
)
const
pagesJson
=
parsePagesJson
(
fs
.
readFileSync
(
pagesJsonPath
,
'
utf8
'
))
const
manifestJson
=
parseManifestJson
(
fs
.
readFileSync
(
manifestJsonPath
,
'
utf8
'
))
const
res
=
require
(
'
@dcloudio/webpack-uni-pages-loader/lib/platforms/app-plus/index.js
'
)(
pagesJson
,
manifestJson
,
false
)
if
(
res
&&
res
[
0
])
{
fs
.
outputFileSync
(
path
.
resolve
(
outputDir
,
'
manifest.json
'
),
res
[
0
].
content
)
}
const
{
done
}
=
require
(
'
@vue/cli-shared-utils
'
)
done
(
'
Build complete.
'
)
}
src/platforms/h5/view/components/map/map-marker.js
浏览文件 @
952982cc
...
...
@@ -131,7 +131,7 @@ export default {
w
=
img
.
width
/
2
h
=
img
.
height
/
2
}
const
top
=
h
-
(
h
-
y
)
const
top
=
h
-
(
h
-
y
*
h
)
if
(
'
MarkerImage
'
in
maps
)
{
icon
=
new
maps
.
MarkerImage
(
img
.
src
,
...
...
@@ -159,29 +159,34 @@ export default {
}
let
label
if
(
labelOpt
.
content
)
{
const
labelStyle
=
{
borderColor
:
labelOpt
.
borderColor
,
borderWidth
:
(
Number
(
labelOpt
.
borderWidth
)
||
0
)
+
'
px
'
,
padding
:
(
Number
(
labelOpt
.
padding
)
||
0
)
+
'
px
'
,
borderRadius
:
(
Number
(
labelOpt
.
borderRadius
)
||
0
)
+
'
px
'
,
backgroundColor
:
labelOpt
.
bgColor
,
color
:
labelOpt
.
color
,
fontSize
:
(
labelOpt
.
fontSize
||
14
)
+
'
px
'
,
lineHeight
:
(
labelOpt
.
fontSize
||
14
)
+
'
px
'
,
marginLeft
:
(
Number
(
labelOpt
.
anchorX
||
labelOpt
.
x
)
||
0
)
+
'
px
'
,
marginTop
:
(
Number
(
labelOpt
.
anchorY
||
labelOpt
.
y
)
||
0
)
+
'
px
'
}
if
(
'
Label
'
in
maps
)
{
label
=
new
maps
.
Label
({
position
:
position
,
map
:
map
,
clickable
:
false
,
content
:
labelOpt
.
content
,
style
:
{
border
:
'
none
'
,
padding
:
'
8px
'
,
background
:
'
none
'
,
color
:
labelOpt
.
color
,
fontSize
:
(
labelOpt
.
fontSize
||
14
)
+
'
px
'
,
lineHeight
:
(
labelOpt
.
fontSize
||
14
)
+
'
px
'
,
marginLeft
:
labelOpt
.
x
,
marginTop
:
labelOpt
.
y
}
style
:
labelStyle
})
marker
.
label
=
label
}
else
if
(
'
setLabel
'
in
marker
)
{
const
className
=
this
.
updateMarkerLabelStyle
(
this
.
id
,
labelStyle
)
marker
.
setLabel
({
text
:
labelOpt
.
content
,
color
:
labelOpt
.
color
,
fontSize
:
(
labelOpt
.
fontSize
||
14
)
+
'
px
'
color
:
labelStyle
.
color
,
fontSize
:
labelStyle
.
fontSize
,
className
})
}
}
...
...
@@ -189,6 +194,7 @@ export default {
let
callout
=
marker
.
callout
let
calloutStyle
if
(
calloutOpt
.
content
||
title
)
{
const
boxShadow
=
'
0px 0px 3px 1px rgba(0,0,0,0.5)
'
calloutStyle
=
calloutOpt
.
content
?
{
position
,
...
...
@@ -200,7 +206,7 @@ export default {
borderRadius
:
calloutOpt
.
borderRadius
,
bgColor
:
calloutOpt
.
bgColor
,
padding
:
calloutOpt
.
padding
,
boxShadow
:
calloutOpt
.
boxShadow
,
boxShadow
:
calloutOpt
.
boxShadow
||
boxShadow
,
display
:
calloutOpt
.
display
}
:
{
...
...
@@ -208,7 +214,7 @@ export default {
map
,
top
,
content
:
title
,
boxShadow
:
'
0px 0px 3px 1px rgba(0,0,0,0.5)
'
boxShadow
:
boxShadow
}
if
(
callout
)
{
callout
.
setOption
(
calloutStyle
)
...
...
@@ -231,12 +237,39 @@ export default {
}
}
}
if
(
option
.
iconPath
)
{
img
.
src
=
getRealPath
(
option
.
iconPath
)
}
else
{
console
.
error
(
'
Marker.iconPath is required.
'
)
}
},
updateMarkerLabelStyle
(
id
,
style
)
{
const
className
=
'
uni-map-marker-label-
'
+
id
let
styleEl
=
document
.
getElementById
(
className
)
if
(
!
styleEl
)
{
styleEl
=
document
.
createElement
(
'
style
'
)
styleEl
.
id
=
className
document
.
head
.
appendChild
(
styleEl
)
this
.
$once
(
'
hook:destroyed
'
,
()
=>
{
styleEl
.
remove
()
})
}
const
newStyle
=
Object
.
assign
({},
style
,
{
position
:
'
absolute
'
,
top
:
'
70px
'
,
borderStyle
:
'
solid
'
})
const
div
=
document
.
createElement
(
'
div
'
)
Object
.
keys
(
newStyle
).
forEach
(
key
=>
{
div
.
style
[
key
]
=
newStyle
[
key
]
||
''
})
styleEl
.
innerText
=
`.
${
className
}
{
${
div
.
getAttribute
(
'
style
'
)}
}`
return
className
},
removeMarker
()
{
const
marker
=
this
.
_marker
if
(
marker
)
{
if
(
marker
.
label
)
{
if
(
marker
.
label
&&
'
setMap
'
in
marker
.
label
)
{
marker
.
label
.
setMap
(
null
)
}
if
(
marker
.
callout
)
{
...
...
src/platforms/h5/view/components/map/maps/callout.js
浏览文件 @
952982cc
...
...
@@ -107,6 +107,11 @@ export function createCallout (maps) {
destroy
=
onRemove
}
Callout
.
prototype
=
overlay
const
prototype
=
Callout
.
prototype
for
(
const
key
in
overlay
)
{
if
(
!
(
key
in
prototype
))
{
prototype
[
key
]
=
overlay
[
key
]
}
}
return
Callout
}
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
浏览文件 @
952982cc
...
...
@@ -61,7 +61,7 @@ function initScopedSlotsParams () {
const
has
=
center
[
vueId
]
if
(
!
has
)
{
parents
[
vueId
]
=
this
this
.
$on
(
'
hook:dest
ory
'
,
()
=>
{
this
.
$on
(
'
hook:dest
royed
'
,
()
=>
{
delete
parents
[
vueId
]
})
}
...
...
@@ -75,7 +75,7 @@ function initScopedSlotsParams () {
return
key
?
object
[
key
]
:
object
}
else
{
parents
[
vueId
]
=
this
this
.
$on
(
'
hook:dest
ory
'
,
()
=>
{
this
.
$on
(
'
hook:dest
royed
'
,
()
=>
{
delete
parents
[
vueId
]
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录