提交 a7c49e06 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor: 优化 $forceUpdate 示例

上级 db0121ae
......@@ -212,9 +212,9 @@
}
},
{
"path": "pages/component-instance/forceUpdate-function/forceUpdate-function",
"path": "pages/component-instance/force-update/force-update",
"style": {
"navigationBarTitleText": "$forceUpdate()"
"navigationBarTitleText": "$forceUpdate"
}
},
{
......@@ -321,12 +321,6 @@
"navigationBarTitleText": "render function"
}
},
{
"path": "pages/rendering/force-update/force-update",
"style": {
"navigationBarTitleText": "$forceUpdate"
}
},
{
"path": "pages/composition/mixins/mixins",
"style": {
......
const PAGE_PATH = '/pages/rendering/force-update/force-update'
const PAGE_PATH = '/pages/component-instance/force-update/force-update'
describe('$forceUpdate', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
......@@ -9,12 +9,12 @@ describe('$forceUpdate', () => {
})
it('basic', async () => {
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')
await triggerForceUpdateBtn.tap()
const timeText2 = await timeEl.text()
const timeText2 = (await timeEl.text()).replace('Date.now(): ', '')
expect(parseInt(timeText2)).toBeGreaterThan(parseInt(timeText1))
})
} else {
......
<template>
<view class="page">
<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
class="uni-common-mt trigger-force-update-btn"
type="primary"
......
<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>
......@@ -259,16 +259,6 @@
url: 'unrecognized-component',
enable: true,
},
{
name: '$forceUpdate',
url: 'force-update',
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
] as PageItem[],
},
{
......@@ -338,8 +328,13 @@
},
{
name: '$forceUpdate',
url: 'forceUpdate-function',
url: 'force-update',
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
{
name: '$nextTick',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册