Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
02acfe73
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
02acfe73
编写于
12月 08, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(mp): improve render props
上级
c8476f73
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
18 addition
and
11 deletion
+18
-11
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+2
-6
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+4
-2
packages/uni-mp-vue/lib/vue.runtime.esm.js
packages/uni-mp-vue/lib/vue.runtime.esm.js
+2
-0
packages/uni-mp-vue/src/helpers/renderProps.ts
packages/uni-mp-vue/src/helpers/renderProps.ts
+10
-3
未找到文件。
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
02acfe73
...
...
@@ -149,8 +149,7 @@ function createEmitFn(oldEmit, ctx) {
}
}
{
const
vnode
=
this
.
$
.
vnode
;
const
props
=
vnode
&&
vnode
.
props
;
const
props
=
scope
.
props
;
if
(
props
&&
props
[
`on
${
capitalize
(
event
)}
`
])
{
return
;
}
...
...
@@ -756,11 +755,8 @@ function triggerEvent(type, detail) {
if
(
!
handler
)
{
return
;
}
const
eventOpts
=
this
.
props
[
'
data-event-opts
'
];
const
target
=
{
dataset
:
{
eventOpts
,
},
dataset
:
{},
};
handler
({
type
:
customize
(
type
),
...
...
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
02acfe73
...
...
@@ -4749,6 +4749,8 @@ function renderComponentRoot(instance) {
instance
.
$ei
=
0
;
// props
pruneComponentPropsCache
(
uid
);
instance
.
__counter
=
instance
.
__counter
===
0
?
1
:
0
;
let
result
;
const
prev
=
setCurrentRenderingInstance
(
instance
);
try
{
...
...
@@ -5076,10 +5078,10 @@ function initApp(app) {
const
propsCaches
=
Object
.
create
(
null
);
function
renderProps
(
props
)
{
const
{
uid
}
=
getCurrentInstance
();
const
{
uid
,
__counter
}
=
getCurrentInstance
();
const
propsId
=
(
propsCaches
[
uid
]
||
(
propsCaches
[
uid
]
=
[])).
push
(
guardReactiveProps
(
props
))
-
1
;
// 强制每次更新
return
uid
+
'
,
'
+
propsId
+
'
,
'
+
Math
.
random
()
;
return
uid
+
'
,
'
+
propsId
+
'
,
'
+
__counter
;
}
function
pruneComponentPropsCache
(
uid
)
{
delete
propsCaches
[
uid
];
...
...
packages/uni-mp-vue/lib/vue.runtime.esm.js
浏览文件 @
02acfe73
...
...
@@ -4749,6 +4749,8 @@ function renderComponentRoot(instance) {
instance
.
$ei
=
0
;
// props
pruneComponentPropsCache
(
uid
);
instance
.
__counter
=
instance
.
__counter
===
0
?
1
:
0
;
let
result
;
const
prev
=
setCurrentRenderingInstance
(
instance
);
try
{
...
...
packages/uni-mp-vue/src/helpers/renderProps.ts
浏览文件 @
02acfe73
import
{
getCurrentInstance
,
guardReactiveProps
}
from
'
vue
'
import
{
ComponentInternalInstance
,
getCurrentInstance
,
guardReactiveProps
,
}
from
'
vue
'
const
propsCaches
:
Record
<
string
,
Record
<
string
,
any
>
[]
>
=
Object
.
create
(
null
)
export
function
renderProps
(
props
:
Data
)
{
const
{
uid
}
=
getCurrentInstance
()
!
const
{
uid
,
__counter
}
=
getCurrentInstance
()
!
as
ComponentInternalInstance
&
{
__counter
:
number
}
const
propsId
=
(
propsCaches
[
uid
]
||
(
propsCaches
[
uid
]
=
[])).
push
(
guardReactiveProps
(
props
)
!
)
-
1
// 强制每次更新
return
uid
+
'
,
'
+
propsId
+
'
,
'
+
Math
.
random
()
return
uid
+
'
,
'
+
propsId
+
'
,
'
+
__counter
}
export
function
pruneComponentPropsCache
(
uid
:
number
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录