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

feat(composition api): unref

上级 bf6fd29f
const PAGE_PATH = '/pages/composition-api/reactivity/un-ref/un-ref'
describe('unref', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page = null
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor('view')
})
it('basic', async () => {
const refCount = await page.$('#ref-count')
expect(await refCount.text()).toBe('ref count: 0')
const refCountType = await page.$('#ref-count-type')
expect(await refCountType.text()).toBe('ref count type: object')
const count = await page.$('#count')
expect(await count.text()).toBe('count: 0')
const isRefCount = await page.$('#count-type')
expect(await isRefCount.text()).toBe('count type: number')
})
} else {
it('other platform', () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
<template><view class="page">unRef</view></template>
\ No newline at end of file
<template>
<view class="page">
<text id="ref-count">ref count: {{ refCount }}</text>
<text class="uni-common-mt" id="ref-count-type">ref count type: {{ refCountType }}</text>
<text class="uni-common-mt" id="count">count: {{ count }}</text>
<text class="uni-common-mt" id="count-type">count type: {{ countType }}</text>
</view>
</template>
<script setup>
const refCount = ref<number>(0);
const refCountType = typeof refCount;
const count = unref(refCount);
const countType = typeof count;
</script>
\ No newline at end of file
......@@ -126,12 +126,12 @@
{
name: 'isRef',
url: 'is-ref',
enable: false,
enable: true,
},
{
name: 'unRef',
url: 'un-ref',
enable: false,
enable: true,
},
{
name: 'toRef',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册