Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
a7c49e06
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
350
Star
2
Fork
7
代码
文件
提交
分支
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看板
提交
a7c49e06
编写于
12月 08, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 优化 $forceUpdate 示例
上级
db0121ae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
64 deletion
+20
-64
pages.json
pages.json
+6
-12
pages/component-instance/force-update/force-update.test.js
pages/component-instance/force-update/force-update.test.js
+3
-3
pages/component-instance/force-update/force-update.uvue
pages/component-instance/force-update/force-update.uvue
+1
-1
pages/component-instance/forceUpdate-function/forceUpdate-function.uvue
...t-instance/forceUpdate-function/forceUpdate-function.uvue
+0
-33
pages/index.uvue
pages/index.uvue
+10
-15
未找到文件。
pages.json
浏览文件 @
a7c49e06
...
@@ -211,12 +211,12 @@
...
@@ -211,12 +211,12 @@
"navigationBarTitleText"
:
"$emit()"
"navigationBarTitleText"
:
"$emit()"
}
}
},
},
{
{
"path"
:
"pages/component-instance/forceUpdate-function/forceUpdate-function
"
,
"path"
:
"pages/component-instance/force-update/force-update
"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"$forceUpdate()
"
"navigationBarTitleText"
:
"$forceUpdate
"
}
}
},
},
{
{
"path"
:
"pages/component-instance/nextTick-function/nextTick-function"
,
"path"
:
"pages/component-instance/nextTick-function/nextTick-function"
,
"style"
:
{
"style"
:
{
...
@@ -321,12 +321,6 @@
...
@@ -321,12 +321,6 @@
"navigationBarTitleText"
:
"render function"
"navigationBarTitleText"
:
"render function"
}
}
},
},
{
"path"
:
"pages/rendering/force-update/force-update"
,
"style"
:
{
"navigationBarTitleText"
:
"$forceUpdate"
}
},
{
{
"path"
:
"pages/composition/mixins/mixins"
,
"path"
:
"pages/composition/mixins/mixins"
,
"style"
:
{
"style"
:
{
...
...
pages/
rendering
/force-update/force-update.test.js
→
pages/
component-instance
/force-update/force-update.test.js
浏览文件 @
a7c49e06
const
PAGE_PATH
=
'
/pages/
rendering
/force-update/force-update
'
const
PAGE_PATH
=
'
/pages/
component-instance
/force-update/force-update
'
describe
(
'
$forceUpdate
'
,
()
=>
{
describe
(
'
$forceUpdate
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
...
@@ -9,12 +9,12 @@ describe('$forceUpdate', () => {
...
@@ -9,12 +9,12 @@ describe('$forceUpdate', () => {
})
})
it
(
'
basic
'
,
async
()
=>
{
it
(
'
basic
'
,
async
()
=>
{
const
timeEl
=
await
page
.
$
(
'
.time
'
)
const
timeEl
=
await
page
.
$
(
'
.time
'
)
const
timeText1
=
await
timeEl
.
text
(
)
const
timeText1
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
await
triggerForceUpdateBtn
.
tap
()
const
timeText2
=
await
timeEl
.
text
(
)
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
})
})
}
else
{
}
else
{
...
...
pages/
rendering
/force-update/force-update.uvue
→
pages/
component-instance
/force-update/force-update.uvue
浏览文件 @
a7c49e06
<template>
<template>
<view class="page">
<view class="page">
<view class="split-title">$forceUpdate</view>
<view class="split-title">$forceUpdate</view>
<text class="uni-common-mt time">{{ Date.now() }}</text>
<text class="uni-common-mt time">
Date.now():
{{ Date.now() }}</text>
<button
<button
class="uni-common-mt trigger-force-update-btn"
class="uni-common-mt trigger-force-update-btn"
type="primary"
type="primary"
...
...
pages/component-instance/forceUpdate-function/forceUpdate-function.uvue
已删除
100644 → 0
浏览文件 @
db0121ae
<template>
<view class="page">
<view class="row">
<text>不支持 $forceUpdate()</text>
</view>
</view>
</template>
<script>
type Obj = {
key: string
}
export default {
data () {
return {
// obj: {} as Obj
}
},
mounted () {
// this.obj.key = 'value'
// console.log(this.$forceUpdate)
}
}
</script>
<style>
.row {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 10px;
}
</style>
pages/index.uvue
浏览文件 @
a7c49e06
...
@@ -258,17 +258,7 @@
...
@@ -258,17 +258,7 @@
name: 'unrecognized component',
name: 'unrecognized component',
url: 'unrecognized-component',
url: 'unrecognized-component',
enable: true,
enable: true,
},
},
{
name: '$forceUpdate',
url: 'force-update',
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
] as PageItem[],
] as PageItem[],
},
},
{
{
...
@@ -336,10 +326,15 @@
...
@@ -336,10 +326,15 @@
url: 'emit-function',
url: 'emit-function',
enable: true,
enable: true,
},
},
{
{
name: '$forceUpdate',
name: '$forceUpdate',
url: 'forceUpdate-function',
url: 'force-update',
enable: false,
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
},
{
{
name: '$nextTick',
name: '$nextTick',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录