Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
7251c5c3
U
uni-app
项目概览
DCloud
/
uni-app
29 天 前同步成功
通知
702
Star
38704
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,发现更多精彩内容 >>
提交
7251c5c3
编写于
7月 01, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
1e876e29
940e1e4e
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
249 addition
and
86 deletion
+249
-86
packages/uni-mp-weixin/lib/uni.config.js
packages/uni-mp-weixin/lib/uni.config.js
+2
-1
packages/uni-template-compiler/__tests__/compiler-extra.spec.js
...es/uni-template-compiler/__tests__/compiler-extra.spec.js
+23
-0
packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js
...ni-template-compiler/__tests__/compiler-mp-alipay.spec.js
+2
-2
packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
...uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
+2
-2
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
...ni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+8
-8
packages/uni-template-compiler/__tests__/compiler.spec.js
packages/uni-template-compiler/__tests__/compiler.spec.js
+24
-0
packages/uni-template-compiler/lib/module.js
packages/uni-template-compiler/lib/module.js
+6
-5
packages/uni-template-compiler/lib/script/traverse/render-slot.js
.../uni-template-compiler/lib/script/traverse/render-slot.js
+1
-1
packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js
...late-compiler/lib/script/traverse/resolve-scoped-slots.js
+7
-2
packages/uni-template-compiler/lib/template/traverse.js
packages/uni-template-compiler/lib/template/traverse.js
+50
-34
packages/vue-cli-plugin-uni/lib/configure-webpack.js
packages/vue-cli-plugin-uni/lib/configure-webpack.js
+1
-1
packages/webpack-uni-mp-loader/lib/plugin/mp-weixin-uniad-app.json.js
...pack-uni-mp-loader/lib/plugin/mp-weixin-uniad-app.json.js
+2
-2
src/core/helpers/promise.js
src/core/helpers/promise.js
+1
-1
src/core/service/plugins/app/index.js
src/core/service/plugins/app/index.js
+26
-6
src/core/view/components/button/index.vue
src/core/view/components/button/index.vue
+3
-1
src/core/view/components/movable-view/index.vue
src/core/view/components/movable-view/index.vue
+3
-0
src/core/view/components/navigator/index.vue
src/core/view/components/navigator/index.vue
+2
-0
src/core/view/mixins/hover.js
src/core/view/mixins/hover.js
+37
-6
src/platforms/app-plus/service/api/plugin/get-provider.js
src/platforms/app-plus/service/api/plugin/get-provider.js
+26
-6
src/platforms/app-plus/view/components/map/index.vue
src/platforms/app-plus/view/components/map/index.vue
+3
-1
src/platforms/h5/service/api/plugin/get-launch-options-sync.js
...latforms/h5/service/api/plugin/get-launch-options-sync.js
+10
-0
src/platforms/h5/view/components/map/index.vue
src/platforms/h5/view/components/map/index.vue
+0
-4
src/platforms/h5/view/components/map/map-marker.js
src/platforms/h5/view/components/map/map-marker.js
+7
-2
src/platforms/h5/view/components/view/index.vue
src/platforms/h5/view/components/view/index.vue
+3
-1
未找到文件。
packages/uni-mp-weixin/lib/uni.config.js
浏览文件 @
7251c5c3
...
...
@@ -29,7 +29,8 @@ module.exports = {
'
sitemap.json
'
,
'
ext.json
'
,
'
custom-tab-bar
'
,
'
functional-pages
'
'
functional-pages
'
,
'
project.private.config.json
'
]
if
(
process
.
env
.
UNI_MP_PLUGIN
)
{
...
...
packages/uni-template-compiler/__tests__/compiler-extra.spec.js
浏览文件 @
7251c5c3
...
...
@@ -274,6 +274,29 @@ describe('mp:compiler-extra', () => {
)
})
it
(
'
generate v-slot with v-if
'
,
()
=>
{
assertCodegen
(
'
<custom-view><template v-if="show">hello</template></custom-view>
'
,
'
<custom-view vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block wx:if="{{show}}">hello</block></custom-view>
'
)
assertCodegen
(
'
<custom-view><template v-if="show" #name>hello</template></custom-view>
'
,
'
<custom-view vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
name
\'
]}}"><view slot="name" wx:if="{{show}}">hello</view></custom-view>
'
)
assertCodegen
(
'
<custom-view><template v-if="show" #name><text>hello</text></template></custom-view>
'
,
'
<custom-view vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
name
\'
]}}"><text slot="name" wx:if="{{show}}">hello</text></custom-view>
'
)
assertCodegen
(
'
<custom-view><template v-if="show" #name><view>hello</view></template></custom-view>
'
,
'
<custom-view vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
name
\'
]}}"><view slot="name" wx:if="{{show}}">hello</view></custom-view>
'
)
assertCodegen
(
'
<custom-view><template v-if="show" #name><view v-if="test1||test2">hello</view></template></custom-view>
'
,
'
<custom-view vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
name
\'
]}}"><view slot="name" wx:if="{{(show)&&(test1||test2)}}">hello</view></custom-view>
'
)
})
it
(
'
generate events inside v-for
'
,
()
=>
{
assertCodegen
(
'
<view v-for="item in dataList" :key="item.id" @click="click1(item, 1);click2(item, 2);"/>
'
,
...
...
packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js
浏览文件 @
7251c5c3
...
...
@@ -116,7 +116,7 @@ describe('mp:compiler-mp-alipay', () => {
)
assertCodegen
(
'
<my-component><template v-slot="{item}">{{getValue(item)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" onVueInit="__l"><block
><block a:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" onVueInit="__l"><block
a:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
...
...
@@ -124,7 +124,7 @@ describe('mp:compiler-mp-alipay', () => {
)
assertCodegen
(
'
<my-component><template v-slot="item">{{getValue(item.text)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" onVueInit="__l"><block
><block a:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" onVueInit="__l"><block
a:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
...
...
packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
浏览文件 @
7251c5c3
...
...
@@ -87,14 +87,14 @@ describe('mp:compiler-mp-baidu', () => {
)
assertCodegen
(
'
<my-component><template v-slot="{item}">{{getValue(item)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" vue-slots="{{[
\'
default
\'
]}}"><block
><block s-if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" vue-slots="{{[
\'
default
\'
]}}"><block
s-if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
}
)
assertCodegen
(
'
<my-component><template v-slot="item">{{getValue(item.text)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" vue-slots="{{[
\'
default
\'
]}}"><block
><block s-if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" vue-slots="{{[
\'
default
\'
]}}"><block
s-if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
}
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
7251c5c3
...
...
@@ -144,7 +144,7 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<my-component><template v-slot="{item}">{{getValue(item)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
...
...
@@ -152,7 +152,7 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<my-component><template v-slot="item">{{getValue(item.text)}}<template></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component scoped-slots-compiler="augmented" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
auto
'
...
...
@@ -219,7 +219,7 @@ describe('mp:compiler-mp-weixin', () => {
it
(
'
generate scoped slot with scopedSlotsCompiler: augmented
'
,
()
=>
{
assertCodegen
(
'
<my-component><template v-slot="{item}">{{getValue(item)}}<template></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
...
...
@@ -227,7 +227,7 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<my-component><template v-slot="{item}">{{item}}<template></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?$getScopedSlotsParams("551070e6-1","default","item"):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
...
...
@@ -235,7 +235,7 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<my-component><template v-slot="item">{{getValue(item.text)}}<template></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
...
...
@@ -243,7 +243,7 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<my-component1><my-component2><template v-slot="{item}">{{getValue(item)}}<template></my-component2></my-component1>
'
,
'
<my-component1 vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><my-component2 vue-id="{{(
\'
551070e6-2
\'
)+
\'
,
\'
+(
\'
551070e6-1
\'
)}}" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}</block>
</block></my-component2></my-component1>
'
,
'
<my-component1 vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><my-component2 vue-id="{{(
\'
551070e6-2
\'
)+
\'
,
\'
+(
\'
551070e6-1
\'
)}}" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}
</block></my-component2></my-component1>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-2");var m1=m0?getValue($getScopedSlotsParams("551070e6-2","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
...
...
@@ -274,8 +274,8 @@ describe('mp:compiler-mp-weixin', () => {
}
)
assertCodegen
(
'
<my-component><template v-slot="{item}">{{item}}<my-component><template v-slot="{item}">{{item}}<
template></my-component><
template></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
><block wx:if="{{$root.m0}}">{{$root.m1}}<my-component vue-id="{{(
\'
551070e6-2
\'
)+
\'
,
\'
+(
\'
551070e6-1
\'
)}}" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block><block wx:if="{{$root.m2}}">{{$root.m3}}</block></block></my-component></block
></block></my-component>
'
,
'
<my-component><template v-slot="{item}">{{item}}<my-component><template v-slot="{item}">{{item}}<
/template></my-component></
template></my-component>
'
,
'
<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block
wx:if="{{$root.m0}}">{{$root.m1}}<my-component vue-id="{{(
\'
551070e6-2
\'
)+
\'
,
\'
+(
\'
551070e6-1
\'
)}}" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}"><block wx:if="{{$root.m2}}">{{$root.m3}}</block></my-component
></block></my-component>
'
,
'
with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?$getScopedSlotsParams("551070e6-1","default","item"):null;var m2=$hasScopedSlotsParams("551070e6-2");var m3=m2?$getScopedSlotsParams("551070e6-2","default","item"):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1,m2:m2,m3:m3}})}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
...
...
packages/uni-template-compiler/__tests__/compiler.spec.js
浏览文件 @
7251c5c3
...
...
@@ -182,6 +182,30 @@ describe('mp:compiler', () => {
'
<view><slot name="one"></slot></view>
'
,
'
<view><slot name="one"></slot></view>
'
)
assertCodegen
(
'
<view><slot :name="one"></slot></view>
'
,
'
<view><slot name="{{one}}"></slot></view>
'
)
assertCodegen
(
'
<view><slot :name="one+
\'
test
\'
"></slot></view>
'
,
'
<view><slot name="{{one+
\'
test
\'
}}"></slot></view>
'
)
assertCodegen
(
'
<view><slot :name="one" :test="test"></slot></view>
'
,
'
<view><slot name="{{one}}"></slot></view>
'
,
'
with(this){{$setScopedSlotsParams(one,{"test":test})}}
'
,
{
scopedSlotsCompiler
:
'
augmented
'
}
)
assertCodegen
(
'
<view><slot :name="one">text</slot></view>
'
,
'
<view><block wx:if="{{$slots[one]}}"><slot name="{{one}}"></slot></block><block wx:else>text</block></view>
'
)
assertCodegen
(
'
<view><slot :name="one+
\'
test
\'
">text</slot></view>
'
,
'
<view><block wx:if="{{$slots[one+
\'
test
\'
]}}"><slot name="{{one+
\'
test
\'
}}"></slot></block><block wx:else>text</block></view>
'
)
})
// it('generate slot fallback content', () => {
...
...
packages/uni-template-compiler/lib/module.js
浏览文件 @
7251c5c3
...
...
@@ -15,12 +15,13 @@ module.exports = {
preTransformNode
(
el
,
{
warn
})
{
if
(
el
.
tag
===
'
slot
'
&&
!
el
.
attrsMap
.
name
)
{
const
attrsMap
=
el
.
attrsMap
if
(
el
.
tag
===
'
slot
'
&&
!
(
attrsMap
.
name
||
attrsMap
[
'
:name
'
]))
{
el
.
attrsList
.
push
({
name
:
'
SLOT_DEFAULT
'
,
value
:
true
})
el
.
attrsMap
.
SLOT_DEFAULT
=
true
attrsMap
.
SLOT_DEFAULT
=
true
}
// 处理 attr
el
.
attrsList
.
forEach
(
attr
=>
{
...
...
@@ -31,11 +32,11 @@ module.exports = {
const
origName
=
attr
.
name
const
newName
=
origName
.
replace
(
'
.lazy
'
,
''
)
attr
.
name
=
newName
el
.
attrsMap
[
newName
]
=
attr
.
value
delete
el
.
attrsMap
[
origName
]
attrsMap
[
newName
]
=
attr
.
value
delete
attrsMap
[
origName
]
}
else
if
(
onRE
.
test
(
attr
.
name
)
&&
!
attr
.
value
.
trim
())
{
// 事件为空
attr
.
value
=
'
__HOLDER__
'
el
.
attrsMap
[
attr
.
name
]
=
attr
.
value
attrsMap
[
attr
.
name
]
=
attr
.
value
}
})
// 暂不支持的指令
...
...
packages/uni-template-compiler/lib/script/traverse/render-slot.js
浏览文件 @
7251c5c3
...
...
@@ -32,7 +32,7 @@ module.exports = function getRenderSlot (path, state) {
const
scoped
=
state
.
scoped
// TODO 判断是否包含作用域内变量
const
renderSlotStatementArray
=
scoped
&&
scoped
.
length
?
scoped
[
scoped
.
length
-
1
].
renderSlotStatementArray
:
state
.
renderSlotStatementArray
renderSlotStatementArray
.
push
(
t
.
expressionStatement
(
t
.
callExpression
(
t
.
identifier
(
'
$setScopedSlotsParams
'
),
[
t
.
stringLiteral
(
name
.
node
.
value
)
,
valueNode
])))
renderSlotStatementArray
.
push
(
t
.
expressionStatement
(
t
.
callExpression
(
t
.
identifier
(
'
$setScopedSlotsParams
'
),
[
name
.
node
,
valueNode
])))
}
// TODO 组件嵌套
}
packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js
浏览文件 @
7251c5c3
...
...
@@ -51,7 +51,12 @@ function replaceId (path, ids) {
}
module
.
exports
=
function
getResolveScopedSlots
(
parent
,
state
)
{
const
properties
=
parent
.
get
(
'
arguments.0.elements.0.properties
'
)
let
objectPath
=
parent
.
get
(
'
arguments.0.elements.0
'
)
// TODO v-else
if
(
objectPath
.
isConditionalExpression
())
{
objectPath
=
objectPath
.
get
(
'
consequent
'
)
}
const
properties
=
objectPath
.
get
(
'
properties
'
)
const
fn
=
properties
.
find
(
path
=>
path
.
get
(
'
key
'
).
isIdentifier
({
name
:
'
fn
'
}))
const
params
=
fn
.
get
(
'
value.params.0
'
)
if
(
!
params
)
{
...
...
@@ -83,7 +88,7 @@ module.exports = function getResolveScopedSlots (parent, state) {
const
test
=
t
.
callExpression
(
t
.
identifier
(
'
$hasScopedSlotsParams
'
),
[
vueId
])
orgin
.
replaceWith
(
t
.
arrayExpression
([
t
.
conditionalExpression
(
test
,
node
,
t
.
callExpression
(
t
.
identifier
(
METHOD_CREATE_EMPTY_VNODE
),
[]))]))
// scopedSlotsCompiler auto
parent
.
get
(
'
arguments.0.elements.0
'
)
.
node
.
scopedSlotsCompiler
=
'
augmented
'
objectPath
.
node
.
scopedSlotsCompiler
=
'
augmented
'
}
}
}
packages/uni-template-compiler/lib/template/traverse.js
浏览文件 @
7251c5c3
...
...
@@ -270,7 +270,7 @@ function traverseArrayExpression (arrayExprNodes, state) {
},
[])
}
function
genSlotNode
(
slotName
,
slotNode
,
fallbackNodes
,
state
)
{
function
genSlotNode
(
slotName
,
slotNode
,
fallbackNodes
,
state
,
isStaticSlotName
=
true
)
{
if
(
!
fallbackNodes
||
t
.
isNullLiteral
(
fallbackNodes
))
{
return
slotNode
}
...
...
@@ -282,7 +282,7 @@ function genSlotNode (slotName, slotNode, fallbackNodes, state) {
return
[{
type
:
'
block
'
,
attr
:
{
[
prefix
+
'
if
'
]:
'
{{$slots.
'
+
slotName
+
'
}}
'
[
prefix
+
'
if
'
]:
isStaticSlotName
?
'
{{$slots.
'
+
slotName
+
'
}}
'
:
'
{{$slots[
'
+
slotName
.
replace
(
/^{{/
,
''
).
replace
(
/}}$/
,
''
)
+
'
]
}}
'
},
children
:
[].
concat
(
slotNode
)
},
{
...
...
@@ -297,12 +297,9 @@ function genSlotNode (slotName, slotNode, fallbackNodes, state) {
}
function
traverseRenderSlot
(
callExprNode
,
state
)
{
if
(
!
t
.
isStringLiteral
(
callExprNode
.
arguments
[
0
]))
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notSupportDynamicSlotName
'
,
{
0
:
'
v-slot
'
}))
return
}
const
slotName
=
callExprNode
.
arguments
[
0
].
value
const
slotNameNode
=
callExprNode
.
arguments
[
0
]
const
isStaticSlotName
=
t
.
isStringLiteral
(
slotNameNode
)
const
slotName
=
isStaticSlotName
?
slotNameNode
.
value
:
genCode
(
slotNameNode
)
let
deleteSlotName
=
false
// 标记是否组件 slot 手动指定了 name="default"
if
(
state
.
options
.
scopedSlotsCompiler
!==
'
augmented
'
&&
callExprNode
.
arguments
.
length
>
2
)
{
// 作用域插槽
...
...
@@ -312,6 +309,10 @@ function traverseRenderSlot (callExprNode, state) {
})
deleteSlotName
=
props
.
SLOT_DEFAULT
&&
Object
.
keys
(
props
).
length
===
1
if
(
!
deleteSlotName
)
{
if
(
!
isStaticSlotName
)
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notSupportDynamicSlotName
'
,
{
0
:
'
v-slot
'
}))
return
}
delete
props
.
SLOT_DEFAULT
return
genSlotNode
(
slotName
,
...
...
@@ -334,28 +335,50 @@ function traverseRenderSlot (callExprNode, state) {
delete
node
.
attr
.
name
}
return
genSlotNode
(
slotName
,
node
,
callExprNode
.
arguments
[
1
],
state
)
return
genSlotNode
(
slotName
,
node
,
callExprNode
.
arguments
[
1
],
state
,
isStaticSlotName
)
}
function
traverseResolveScopedSlots
(
callExprNode
,
state
)
{
function
single
(
children
,
slotName
,
ignore
)
{
if
(
Array
.
isArray
(
children
)
&&
children
.
length
===
1
)
{
const
child
=
children
[
0
]
if
(
!
child
.
type
)
{
return
}
if
(
ignore
.
includes
(
child
.
type
))
{
return
single
(
child
.
children
,
slotName
,
ignore
)
const
options
=
state
.
options
const
vIfAttrName
=
options
.
platform
.
directive
+
'
if
'
function
single
(
node
,
slotName
,
vIfCode
,
ignore
)
{
let
last
=
node
const
vIfs
=
vIfCode
?
[
vIfCode
]
:
[]
function
find
(
children
)
{
if
(
Array
.
isArray
(
children
)
&&
children
.
length
===
1
)
{
const
child
=
children
[
0
]
if
(
!
child
.
type
)
{
return
}
last
=
child
if
(
child
.
attr
&&
child
.
attr
[
vIfAttrName
])
{
vIfs
.
push
(
child
.
attr
[
vIfAttrName
])
delete
child
.
attr
[
vIfAttrName
]
}
if
(
ignore
.
includes
(
child
.
type
)
&&
!
(
child
.
attr
&&
Object
.
keys
(
child
.
attr
).
length
))
{
find
(
child
.
children
,
ignore
)
}
}
child
.
attr
=
child
.
attr
||
{}
child
.
attr
.
slot
=
slotName
return
true
}
find
(
node
.
children
)
last
.
attr
=
last
.
attr
||
{}
last
.
attr
.
slot
=
slotName
if
(
vIfs
.
length
)
{
// 简易合并
last
.
attr
[
vIfAttrName
]
=
vIfs
.
length
>
1
?
`{{
${
vIfs
.
map
(
str
=>
str
.
replace
(
/^
\{\{(
.+
)\}\}
$/
,
'
($1)
'
)).
join
(
'
&&
'
)}
}}`
:
vIfs
[
0
]
}
return
last
}
return
callExprNode
.
arguments
[
0
].
elements
.
map
(
slotNode
=>
{
let
keyProperty
=
false
let
fnProperty
=
false
let
proxyProperty
=
false
let
vIfCode
// TODO v-else
if
(
t
.
isConditionalExpression
(
slotNode
))
{
vIfCode
=
genCode
(
slotNode
.
test
)
slotNode
=
slotNode
.
consequent
}
slotNode
.
properties
.
forEach
(
property
=>
{
switch
(
property
.
key
.
name
)
{
case
'
key
'
:
...
...
@@ -371,14 +394,14 @@ function traverseResolveScopedSlots (callExprNode, state) {
const
slotName
=
keyProperty
.
value
.
value
const
returnExprNodes
=
fnProperty
.
value
.
body
.
body
[
0
].
argument
const
parentNode
=
callExprNode
.
$node
if
(
slotNode
.
scopedSlotsCompiler
!==
'
augmented
'
&&
!
proxyProperty
)
{
const
resourcePath
=
state
.
options
.
resourcePath
if
(
options
.
scopedSlotsCompiler
!==
'
augmented
'
&&
slotNode
.
scopedSlotsCompiler
!==
'
augmented
'
&&
!
proxyProperty
)
{
const
resourcePath
=
options
.
resourcePath
const
ownerName
=
path
.
basename
(
resourcePath
,
path
.
extname
(
resourcePath
))
const
parentName
=
parentNode
.
type
const
paramExprNode
=
fnProperty
.
value
.
params
[
0
]
return
state
.
options
.
platform
.
resolveScopedSlots
(
return
options
.
platform
.
resolveScopedSlots
(
slotName
,
{
genCode
,
generate
,
...
...
@@ -398,21 +421,14 @@ function traverseResolveScopedSlots (callExprNode, state) {
state
)
}
if
(
state
.
options
.
scopedSlotsCompiler
===
'
auto
'
&&
slotNode
.
scopedSlotsCompiler
===
'
augmented
'
)
{
if
(
options
.
scopedSlotsCompiler
===
'
auto
'
&&
slotNode
.
scopedSlotsCompiler
===
'
augmented
'
)
{
parentNode
.
attr
[
'
scoped-slots-compiler
'
]
=
'
augmented
'
}
const
children
=
normalizeChildren
(
traverseExpr
(
returnExprNodes
,
state
))
// 除百度、字节外其他小程序仅默认插槽可以支持多个节点
if
(
single
(
children
,
slotName
,
[
'
template
'
,
'
block
'
]))
{
return
children
[
0
]
}
return
{
return
single
({
type
:
'
block
'
,
attr
:
{
slot
:
slotName
},
children
}
children
:
normalizeChildren
(
traverseExpr
(
returnExprNodes
,
state
))
},
slotName
,
vIfCode
,
[
'
template
'
,
'
block
'
])
})
}
...
...
packages/vue-cli-plugin-uni/lib/configure-webpack.js
浏览文件 @
7251c5c3
...
...
@@ -285,7 +285,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
process
.
env
.
UNI_PLATFORM
!==
'
mp-alipay
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
quickapp-webview
'
// 目前 ov 的开发工具支持 eval 模式
)
{
plugins
.
push
(
sourceMap
.
createSourceMapDevToolPlugin
(
process
.
env
.
UNI_PLATFORM
===
'
mp-weixin
'
))
plugins
.
push
(
sourceMap
.
createSourceMapDevToolPlugin
(
process
.
env
.
UNI_PLATFORM
===
'
mp-weixin
'
||
process
.
env
.
UNI_PLATFORM
===
'
mp-toutiao
'
))
}
}
...
...
packages/webpack-uni-mp-loader/lib/plugin/mp-weixin-uniad-app.json.js
浏览文件 @
7251c5c3
...
...
@@ -4,13 +4,13 @@ module.exports = function (appJson) {
}
if
(
!
appJson
.
plugins
[
'
uni-ad
'
])
{
appJson
.
plugins
[
'
uni-ad
'
]
=
{
version
:
'
1.
0.3
'
,
version
:
'
1.
1.0
'
,
provider
:
'
wx999bf02c8e05dfc9
'
}
}
if
(
!
appJson
.
plugins
[
'
coral-adv
'
])
{
appJson
.
plugins
[
'
coral-adv
'
]
=
{
version
:
'
1.0.
7
'
,
version
:
'
1.0.
9
'
,
provider
:
'
wx0e203209e27b1e66
'
}
}
...
...
src/core/helpers/promise.js
浏览文件 @
7251c5c3
...
...
@@ -8,7 +8,7 @@ import {
}
from
'
./interceptor
'
const
SYNC_API_RE
=
/^
\$
|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo/
/^
\$
|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo
|getSystemSetting|getAppAuthorizeSetting
/
const
CONTEXT_API_RE
=
/^create|Manager$/
...
...
src/core/service/plugins/app/index.js
浏览文件 @
7251c5c3
...
...
@@ -10,6 +10,29 @@ export {
}
from
'
./create-app
'
export
let
createLaunchOptions
=
function
()
{
const
scene
=
1001
const
referrerInfo
=
{
appId
:
''
,
extraData
:
{},
}
try
{
return
{
path
:
this
.
$route
.
meta
&&
this
.
$route
.
meta
.
pagePath
,
query
:
this
.
$route
.
query
,
scene
,
referrerInfo
}
}
catch
(
error
)
{
return
{
path
:
''
,
query
:
{},
scene
,
referrerInfo
}
}
}
export
function
createAppMixin
(
Vue
,
routes
,
entryRoute
)
{
return
{
created
:
function
AppCreated
()
{
...
...
@@ -31,13 +54,10 @@ export function createAppMixin (Vue, routes, entryRoute) {
},
mounted
:
function
appMounted
()
{
// 稍微靠后点,让 App 有机会在 mounted 事件前注册一些全局事件监听,如 UI 显示(showModal)
const
args
=
{
path
:
this
.
$route
.
meta
&&
this
.
$route
.
meta
.
pagePath
,
query
:
this
.
$route
.
query
,
scene
:
1001
}
createLaunchOptions
=
createLaunchOptions
.
bind
(
this
)
const
args
=
createLaunchOptions
()
callAppHook
(
this
,
'
onLaunch
'
,
args
)
callAppHook
(
this
,
'
onShow
'
,
args
)
}
}
}
}
src/core/view/components/button/index.vue
浏览文件 @
7251c5c3
...
...
@@ -130,6 +130,8 @@ export default {
touchstart
:
this
.
_hoverTouchStart
,
touchend
:
this
.
_hoverTouchEnd
,
touchcancel
:
this
.
_hoverTouchCancel
,
mousedown
:
this
.
_hoverMousedown
,
mouseup
:
this
.
_hoverMouseup
,
click
:
this
.
_onClick
}
},
...
...
@@ -429,4 +431,4 @@ export default {
border-color
:
rgba
(
230
,
67
,
64
,
0.6
);
background-color
:
transparent
;
}
</
style
>
</
style
>
src/core/view/components/movable-view/index.vue
浏览文件 @
7251c5c3
...
...
@@ -185,6 +185,9 @@ export default {
ySync
(
val
)
{
this
.
_setY
(
val
)
},
disabled
()
{
this
.
__handleTouchStart
()
},
scaleValue
(
val
)
{
this
.
scaleValueSync
=
Number
(
val
)
||
0
},
...
...
src/core/view/components/navigator/index.vue
浏览文件 @
7251c5c3
...
...
@@ -5,6 +5,8 @@
@
touchstart=
"_hoverTouchStart"
@
touchend=
"_hoverTouchEnd"
@
touchcancel=
"_hoverTouchCancel"
@
mousedown=
"_hoverMousedown"
@
mouseup=
"_hoverMouseup"
@
click=
"_onClick"
v-on=
"$listeners"
>
...
...
src/core/view/mixins/hover.js
浏览文件 @
7251c5c3
...
...
@@ -4,6 +4,7 @@ export default {
hovering
:
false
}
},
props
:
{
hoverClass
:
{
type
:
String
,
...
...
@@ -22,8 +23,25 @@ export default {
default
:
400
}
},
methods
:
{
_hoverTouchStart
(
evt
)
{
if
(
evt
.
touches
.
length
>
1
)
{
return
}
this
.
_handleHoverStart
(
evt
)
},
_hoverMousedown
(
evt
)
{
if
(
this
.
_hoverTouch
)
{
return
}
this
.
_handleHoverStart
(
evt
)
window
.
addEventListener
(
'
mouseup
'
,
this
.
_hoverMouseup
)
},
_handleHoverStart
(
evt
)
{
// TODO detect scrolling
if
(
evt
.
_hoverPropagationStopped
)
{
return
...
...
@@ -31,9 +49,6 @@ export default {
if
(
!
this
.
hoverClass
||
this
.
hoverClass
===
'
none
'
||
this
.
disabled
)
{
return
}
if
(
evt
.
touches
.
length
>
1
)
{
return
}
if
(
this
.
hoverStopPropagation
)
{
evt
.
_hoverPropagationStopped
=
true
}
...
...
@@ -45,12 +60,27 @@ export default {
}
},
this
.
hoverStartTime
)
},
_hoverTouchEnd
(
evt
)
{
_hoverMouseup
()
{
if
(
!
this
.
_hoverTouch
)
{
return
}
this
.
_handleHoverEnd
()
window
.
removeEventListener
(
'
mouseup
'
,
this
.
_hoverMouseup
)
},
_hoverTouchEnd
()
{
this
.
_handleHoverEnd
()
},
_handleHoverEnd
()
{
this
.
_hoverTouch
=
false
if
(
this
.
hovering
)
{
this
.
_hoverReset
()
}
},
_hoverReset
()
{
requestAnimationFrame
(()
=>
{
clearTimeout
(
this
.
_hoverStayTimer
)
...
...
@@ -59,10 +89,11 @@ export default {
},
this
.
hoverStayTime
)
})
},
_hoverTouchCancel
(
evt
)
{
_hoverTouchCancel
()
{
this
.
_hoverTouch
=
false
this
.
hovering
=
false
clearTimeout
(
this
.
_hoverStartTimer
)
}
}
}
}
src/platforms/app-plus/service/api/plugin/get-provider.js
浏览文件 @
7251c5c3
import
{
invoke
}
from
'
../../bridge
'
import
{
isFn
,
isPlainObject
}
from
'
uni-shared
'
const
providers
=
{
oauth
(
callback
)
{
...
...
@@ -11,7 +12,7 @@ const providers = {
})
=>
{
provider
.
push
(
id
)
})
callback
(
null
,
provider
)
callback
(
null
,
provider
,
services
)
},
err
=>
{
callback
(
err
)
})
...
...
@@ -24,7 +25,7 @@ const providers = {
})
=>
{
provider
.
push
(
id
)
})
callback
(
null
,
provider
)
callback
(
null
,
provider
,
services
)
},
err
=>
{
callback
(
err
)
})
...
...
@@ -37,14 +38,15 @@ const providers = {
})
=>
{
provider
.
push
(
id
)
})
callback
(
null
,
provider
)
callback
(
null
,
provider
,
services
)
},
err
=>
{
callback
(
err
)
})
},
push
(
callback
)
{
if
(
typeof
weex
!==
'
undefined
'
||
typeof
plus
!==
'
undefined
'
)
{
callback
(
null
,
[
plus
.
push
.
getClientInfo
().
id
])
const
clientInfo
=
plus
.
push
.
getClientInfo
()
callback
(
null
,
[
clientInfo
.
id
],
[
clientInfo
])
}
else
{
callback
(
null
,
[])
}
...
...
@@ -55,7 +57,7 @@ export function getProvider ({
service
},
callbackId
)
{
if
(
providers
[
service
])
{
providers
[
service
]((
err
,
provider
)
=>
{
providers
[
service
]((
err
,
provider
,
providers
)
=>
{
if
(
err
)
{
invoke
(
callbackId
,
{
errMsg
:
'
getProvider:fail
'
+
err
.
message
...
...
@@ -64,7 +66,25 @@ export function getProvider ({
invoke
(
callbackId
,
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
provider
,
providers
:
providers
.
map
((
provider
)
=>
{
const
returnProvider
=
{}
if
(
isPlainObject
(
provider
))
{
for
(
const
key
in
provider
)
{
if
(
Object
.
hasOwnProperty
.
call
(
provider
,
key
))
{
const
item
=
provider
[
key
]
if
(
!
isFn
(
item
)
&&
typeof
item
!==
'
undefined
'
)
{
const
_key
=
key
===
'
nativeClient
'
||
key
===
'
serviceReady
'
?
'
isAppExist
'
:
key
returnProvider
[
_key
]
=
item
}
}
}
}
return
returnProvider
})
})
}
})
...
...
src/platforms/app-plus/view/components/map/index.vue
浏览文件 @
7251c5c3
...
...
@@ -320,7 +320,9 @@ export default {
if
(
id
||
id
===
0
)
{
nativeMarker
.
onclick
=
(
e
)
=>
{
this
.
$trigger
(
'
markertap
'
,
{},
{
markerId
:
id
markerId
:
id
,
latitude
,
longitude
})
}
if
(
nativeBubble
)
{
...
...
src/platforms/h5/service/api/plugin/get-launch-options-sync.js
0 → 100644
浏览文件 @
7251c5c3
import
{
createLaunchOptions
}
from
'
uni-core/service/plugins/app
'
export
function
getLaunchOptionsSync
()
{
return
createLaunchOptions
()
}
export
function
getEnterOptionsSync
()
{
return
createLaunchOptions
()
}
src/platforms/h5/view/components/map/index.vue
浏览文件 @
7251c5c3
...
...
@@ -374,10 +374,6 @@ export default {
this
.
isBoundsReady
=
true
this
.
$emit
(
'
boundsready
'
)
})
maps
.
event
.
addListener
(
map
,
'
click
'
,
()
=>
{
// TODO 编译器将 tap 转换为click
this
.
$trigger
(
'
click
'
,
{},
{})
})
maps
.
event
.
addListener
(
map
,
'
dragstart
'
,
()
=>
{
this
.
$trigger
(
'
regionchange
'
,
{},
{
type
:
'
begin
'
,
...
...
src/platforms/h5/view/components/map/map-marker.js
浏览文件 @
7251c5c3
...
...
@@ -95,7 +95,7 @@ export default {
})
this
.
$parent
.
_markers
[
this
.
idString
]
=
marker
this
.
updateMarker
(
props
)
maps
.
event
.
addListener
(
marker
,
'
click
'
,
()
=>
{
maps
.
event
.
addListener
(
marker
,
'
click
'
,
(
e
)
=>
{
const
callout
=
marker
.
callout
if
(
callout
)
{
const
div
=
callout
.
div
...
...
@@ -110,9 +110,14 @@ export default {
}
if
(
this
.
idString
)
{
this
.
$parent
.
$trigger
(
'
markertap
'
,
{},
{
markerId
:
Number
(
this
.
idString
)
markerId
:
Number
(
this
.
idString
),
latitude
:
typeof
e
.
latLng
.
lat
===
'
function
'
?
e
.
latLng
.
lat
()
:
e
.
latLng
.
lat
,
longitude
:
typeof
e
.
latLng
.
lat
===
'
function
'
?
e
.
latLng
.
lng
()
:
e
.
latLng
.
lng
})
}
const
event
=
e
.
event
||
e
.
domEvent
event
.
stopPropagation
()
})
},
updateMarker
(
option
)
{
...
...
src/platforms/h5/view/components/view/index.vue
浏览文件 @
7251c5c3
...
...
@@ -5,13 +5,15 @@
@
touchstart=
"_hoverTouchStart"
@
touchend=
"_hoverTouchEnd"
@
touchcancel=
"_hoverTouchCancel"
@
mousedown=
"_hoverMousedown"
@
mouseup=
"_hoverMouseup"
v-on=
"$listeners"
>
<slot
/>
</uni-view>
<uni-view
v-else
v-on=
"$listeners"
v-on=
"$listeners"
>
<slot
/>
</uni-view>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录