Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
b8675d88
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
402
Star
3
Fork
10
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b8675d88
编写于
4月 17, 2024
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(component-instance): $forceUpdate
上级
ba25eab3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
61 addition
and
26 deletion
+61
-26
pages.json
pages.json
+8
-2
pages/component-instance/force-update/force-update-composition.uvue
...onent-instance/force-update/force-update-composition.uvue
+4
-4
pages/component-instance/force-update/force-update-options.uvue
...component-instance/force-update/force-update-options.uvue
+0
-0
pages/component-instance/force-update/force-update.test.js
pages/component-instance/force-update/force-update.test.js
+32
-19
pages/index/index.uvue
pages/index/index.uvue
+17
-1
未找到文件。
pages.json
浏览文件 @
b8675d88
...
...
@@ -346,9 +346,15 @@
}
},
{
"path"
:
"pages/component-instance/force-update/force-update"
,
"path"
:
"pages/component-instance/force-update/force-update
-options
"
,
"style"
:
{
"navigationBarTitleText"
:
"$forceUpdate"
"navigationBarTitleText"
:
"$forceUpdate 选项式 API"
}
},
{
"path"
:
"pages/component-instance/force-update/force-update-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"$forceUpdate 组合式 API"
}
},
{
...
...
pages/component-instance/force-update/force-update-composition.uvue
浏览文件 @
b8675d88
<template>
<view class="page">
<view class="split-title">$forceUpdate</view>
<text class="
uni-common-mt
time">Date.now(): {{ Date.now() }}</text>
<button class="
uni-common-mt
trigger-force-update-btn" type="primary" @click="triggerForceUpdate">trigger $forceUpdate</button>
<text class="
mt-10
time">Date.now(): {{ Date.now() }}</text>
<button class="
mt-10
trigger-force-update-btn" type="primary" @click="triggerForceUpdate">trigger $forceUpdate</button>
</view>
</template>
...
...
@@ -10,10 +10,10 @@
const instance = getCurrentInstance()
const triggerForceUpdate = () => {
instance
.$.
forceUpdate()
instance
?.proxy?.$
forceUpdate()
}
defineExpose({
triggerForceUpdate
})
</script>
</script>
\ No newline at end of file
pages/component-instance/force-update/force-update.uvue
→
pages/component-instance/force-update/force-update
-options
.uvue
浏览文件 @
b8675d88
文件已移动
pages/component-instance/force-update/force-update.test.js
浏览文件 @
b8675d88
const
PAGE_PATH
=
'
/pages/component-instance/force-update/force-update
'
describe
(
'
$forceUpdate
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
basic
'
,
async
()
=>
{
const
timeEl
=
await
page
.
$
(
'
.time
'
)
const
timeText1
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
})
})
const
PAGE_PATH
=
'
/pages/component-instance/force-update/force-update-options
'
const
PAGE_COMPOSITION_PATH
=
'
/pages/component-instance/force-update/force-update-composition
'
describe
(
'
$forceUpdate
'
,
()
=>
{
let
page
it
(
'
force-update Options API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
const
timeEl
=
await
page
.
$
(
'
.time
'
)
const
timeText1
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
})
it
(
'
force-update Composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_COMPOSITION_PATH
)
await
page
.
waitFor
(
'
view
'
)
const
timeEl
=
await
page
.
$
(
'
.time
'
)
const
timeText1
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
})
})
pages/index/index.uvue
浏览文件 @
b8675d88
...
...
@@ -261,7 +261,23 @@ export default {
{
id: 'emit-composition',
name: 'defineEmits 组合式 API',
url: 'emit-function-options'
url: 'emit-function-composition'
}
]
},
{
id: 'force-update',
name: '$force-update',
children: [
{
id: 'force-update-options',
name: '$forceUpdate 选项式 API',
url: 'force-update-options'
},
{
id: 'force-update-composition',
name: '$forceUpdate 组合式 API',
url: 'force-update-composition'
}
]
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录