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

refactor(reactivity): isRef

......@@ -543,6 +543,11 @@ export default {
name: 'isReadonly',
url: 'is-readonly/is-readonly'
},
{
id: 'is-ref',
name: 'isRef',
url: 'is-ref/is-ref'
},
]
}
] as Page[]
......
const PAGE_PATH = '/pages/composition-api/reactivity/is-ref/is-ref'
const PAGE_PATH = '/pages/reactivity/utilities/is-ref/is-ref'
describe('isRef', () => {
let page = null
......@@ -8,13 +8,13 @@ describe('isRef', () => {
})
it('basic', async () => {
const refCount = await page.$('#ref-count')
expect(await refCount.text()).toBe('ref count: 0')
expect(await refCount.text()).toBe('0')
const isRefRefCount = await page.$('#is-ref-ref-count')
expect(await isRefRefCount.text()).toBe('isRef ref count: true')
expect(await isRefRefCount.text()).toBe('true')
const count = await page.$('#count')
expect(await count.text()).toBe('count: 0')
expect(await count.text()).toBe('0')
const isRefCount = await page.$('#is-ref-count')
expect(await isRefCount.text()).toBe('isRef count: false')
expect(await isRefCount.text()).toBe('false')
})
})
\ No newline at end of file
<template>
<view class="page">
<text id="ref-count">ref count: {{ refCount }}</text>
<text class="mt-10" id="is-ref-ref-count">isRef ref count: {{ isRefRefCount }}</text>
<text class="mt-10" id="count">count: {{ count }}</text>
<text class="mt-10" id="is-ref-count">isRef count: {{ isRefCount }}</text>
<view class="flex justify-between flex-row mb-10">
<text>ref count:</text>
<text id="ref-count">{{ refCount }}</text>
</view>
<view class="flex justify-between flex-row mb-10">
<text>isRef ref count:</text>
<text id="is-ref-ref-count">{{ isRefRefCount }}</text>
</view>
<view class="flex justify-between flex-row mb-10">
<text>count:</text>
<text id="count">{{ count }}</text>
</view>
<view class="flex justify-between flex-row mb-10">
<text>isRef count:</text>
<text id="is-ref-count">{{ isRefCount }}</text>
</view>
</view>
</template>
<script setup>
const refCount = ref(0);
const count = 0;
const isRefRefCount = isRef(refCount);
const isRefCount = isRef(count);
</script>
\ No newline at end of file
<script setup lang="uts">
const refCount = ref(0);
const count = 0;
const isRefRefCount = isRef(refCount);
const isRefCount = isRef(count);
</script>
......@@ -134,7 +134,7 @@ function transform(fileInfo, api) {
- [x] isProxy
- [x] isReactive
- [x] isReadonly
- [ ] isRef
- [x] isRef
- [ ] toRef
- [ ] toRefs
- [ ] toValue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部