Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
907895a5
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
Star
38705
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,发现更多精彩内容 >>
提交
907895a5
编写于
6月 10, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): $mp.component -> $scope
上级
84f69f15
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
8 deletion
+8
-8
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
+3
-3
packages/uni-template-compiler/lib/script/traverse/index.js
packages/uni-template-compiler/lib/script/traverse/index.js
+1
-1
未找到文件。
packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js
浏览文件 @
907895a5
...
@@ -115,7 +115,7 @@ describe('mp:compiler-mp-alipay', () => {
...
@@ -115,7 +115,7 @@ describe('mp:compiler-mp-alipay', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot :item="item"><slot></view>
'
,
'
<view><slot :item="item"><slot></view>
'
,
'
<view><block a:if="{{$slots.$default}}"><slot item="{{item}}"></slot></block><block a:else><slot></slot></block></view>
'
,
'
<view><block a:if="{{$slots.$default}}"><slot item="{{item}}"></slot></block><block a:else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.props.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
'
with(this){if($
scope
.props.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
@@ -123,7 +123,7 @@ describe('mp:compiler-mp-alipay', () => {
...
@@ -123,7 +123,7 @@ describe('mp:compiler-mp-alipay', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><block a:if="{{$slots.$default}}"><slot></slot></block><block a:else><slot></slot></block></view>
'
,
'
<view><block a:if="{{$slots.$default}}"><slot></slot></block><block a:else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.props.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
'
with(this){if($
scope
.props.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
...
packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
浏览文件 @
907895a5
...
@@ -93,7 +93,7 @@ describe('mp:compiler-mp-baidu', () => {
...
@@ -93,7 +93,7 @@ describe('mp:compiler-mp-baidu', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot :item="item"><slot></view>
'
,
'
<view><slot :item="item"><slot></view>
'
,
'
<view><block s-if="{{$slots.default}}"><slot var-item="item"></slot></block><block s-else><slot></slot></block></view>
'
,
'
<view><block s-if="{{$slots.default}}"><slot var-item="item"></slot></block><block s-else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
'
with(this){if($
scope
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
@@ -101,7 +101,7 @@ describe('mp:compiler-mp-baidu', () => {
...
@@ -101,7 +101,7 @@ describe('mp:compiler-mp-baidu', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><block s-if="{{$slots.default}}"><slot></slot></block><block s-else><slot></slot></block></view>
'
,
'
<view><block s-if="{{$slots.default}}"><slot></slot></block><block s-else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
'
with(this){if($
scope
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
...
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
907895a5
...
@@ -110,7 +110,7 @@ describe('mp:compiler-mp-weixin', () => {
...
@@ -110,7 +110,7 @@ describe('mp:compiler-mp-weixin', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot :item="item"><slot></view>
'
,
'
<view><slot :item="item"><slot></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot><scoped-slots-default item="{{item}}" class="scoped-ref" bind:__l="__l"></scoped-slots-default></block><block wx:else><slot></slot></block></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot><scoped-slots-default item="{{item}}" class="scoped-ref" bind:__l="__l"></scoped-slots-default></block><block wx:else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
'
with(this){if($
scope
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":item})}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
@@ -118,7 +118,7 @@ describe('mp:compiler-mp-weixin', () => {
...
@@ -118,7 +118,7 @@ describe('mp:compiler-mp-weixin', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot :item="getValue(item)"><slot></view>
'
,
'
<view><slot :item="getValue(item)"><slot></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot><scoped-slots-default item="{{$root.m0}}" class="scoped-ref" bind:__l="__l"></scoped-slots-default></block><block wx:else><slot></slot></block></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot><scoped-slots-default item="{{$root.m0}}" class="scoped-ref" bind:__l="__l"></scoped-slots-default></block><block wx:else><slot></slot></block></view>
'
,
'
with(this){var m0=getValue(item);$mp.data=Object.assign({},{$root:{m0:m0}});if($
mp.component
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":$root.m0})}}
'
,
'
with(this){var m0=getValue(item);$mp.data=Object.assign({},{$root:{m0:m0}});if($
scope
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",{"item":$root.m0})}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
@@ -126,7 +126,7 @@ describe('mp:compiler-mp-weixin', () => {
...
@@ -126,7 +126,7 @@ describe('mp:compiler-mp-weixin', () => {
assertCodegen
(
assertCodegen
(
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><slot v-bind="object"><slot></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot></block><block wx:else><slot></slot></block></view>
'
,
'
<view><block wx:if="{{$slots.default}}"><slot></slot></block><block wx:else><slot></slot></block></view>
'
,
'
with(this){if($
mp.component
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
'
with(this){if($
scope
.data.scopedSlotsCompiler==="augmented"){const $root=$mp.data.$root;$setScopedSlotsParams("default",object)}}
'
,
{
{
scopedSlotsCompiler
:
'
auto
'
scopedSlotsCompiler
:
'
auto
'
}
}
...
...
packages/uni-template-compiler/lib/script/traverse/index.js
浏览文件 @
907895a5
...
@@ -117,7 +117,7 @@ module.exports = function traverse (ast, state) {
...
@@ -117,7 +117,7 @@ module.exports = function traverse (ast, state) {
if
(
state
.
options
.
scopedSlotsCompiler
===
'
auto
'
)
{
if
(
state
.
options
.
scopedSlotsCompiler
===
'
auto
'
)
{
const
node
=
t
.
ifStatement
(
const
node
=
t
.
ifStatement
(
t
.
binaryExpression
(
'
===
'
,
t
.
binaryExpression
(
'
===
'
,
t
.
memberExpression
(
t
.
memberExpression
(
t
.
memberExpression
(
t
.
identifier
(
'
$mp
'
),
t
.
identifier
(
'
component
'
)
),
t
.
identifier
(
state
.
options
.
platform
.
name
===
'
mp-alipay
'
?
'
props
'
:
'
data
'
)),
t
.
identifier
(
'
scopedSlotsCompiler
'
)),
t
.
stringLiteral
(
'
augmented
'
)
t
.
memberExpression
(
t
.
memberExpression
(
t
.
identifier
(
'
$scope
'
),
t
.
identifier
(
state
.
options
.
platform
.
name
===
'
mp-alipay
'
?
'
props
'
:
'
data
'
)),
t
.
identifier
(
'
scopedSlotsCompiler
'
)),
t
.
stringLiteral
(
'
augmented
'
)
),
),
t
.
blockStatement
([
t
.
blockStatement
([
t
.
variableDeclaration
(
'
const
'
,
[
t
.
variableDeclarator
(
t
.
identifier
(
'
$root
'
),
t
.
variableDeclaration
(
'
const
'
,
[
t
.
variableDeclarator
(
t
.
identifier
(
'
$root
'
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录