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

feat(composition api): isProxy

上级 7627160e
const PAGE_PATH = '/pages/composition-api/reactivity/is-proxy/is-proxy'
describe('isProxy', () => {
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 isProxyCount = await page.$('#is-proxy-count')
expect(await isProxyCount.text()).toBe('isProxy(count): false')
const isProxyRefCount = await page.$('#is-proxy-ref-count')
expect(await isProxyRefCount.text()).toBe('isProxy(refCount): false')
const isProxyReactiveCount = await page.$('#is-proxy-reactive-count')
expect(await isProxyReactiveCount.text()).toBe('isProxy(reactiveCount): true')
const isProxyReadonlyCount = await page.$('#is-proxy-readonly-count')
expect(await isProxyReadonlyCount.text()).toBe('isProxy(readonlyCount): true')
const isProxyShallowReactiveCount = await page.$('#is-proxy-shallow-reactive-count')
expect(await isProxyShallowReactiveCount.text()).toBe('isProxy(shallowReactiveCount): true')
const isProxyShallowReadonlyCount = await page.$('#is-proxy-shallow-readonly-count')
expect(await isProxyShallowReadonlyCount.text()).toBe('isProxy(shallowReadonlyCount): true')
})
} else {
it('other platform', () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
<template><view class="page">isProxy</view></template>
\ No newline at end of file
<template>
<view class="page">
<text id="is-proxy-count">isProxy(count): {{ isProxyCount }}</text>
<text class="uni-common-mt" id="is-proxy-ref-count">isProxy(refCount): {{ isProxyRefCount }}</text>
<text class="uni-common-mt" id="is-proxy-reactive-count">isProxy(reactiveCount): {{ isProxyReactiveCount }}</text>
<text class="uni-common-mt" id="is-proxy-readonly-count">isProxy(readonlyCount): {{ isProxyReadonlyCount }}</text>
<text class="uni-common-mt" id="is-proxy-shallow-reactive-count">isProxy(shallowReactiveCount): {{ isProxyShallowReactiveCount }}</text>
<text class="uni-common-mt" id="is-proxy-shallow-readonly-count">isProxy(shallowReadonlyCount): {{ isProxyShallowReadonlyCount }}</text>
</view>
</template>
<script setup>
const count = 0;
const isProxyCount = isProxy(count);
const refCount = ref(0);
const isProxyRefCount = isProxy(refCount);
const reactiveCount = reactive({ count: 0 });
const isProxyReactiveCount = isProxy(reactiveCount);
const readonlyCount = readonly({ count: 0 });
const isProxyReadonlyCount = isProxy(readonlyCount);
const shallowReactiveCount = shallowReactive({ count: 0 });
const isProxyShallowReactiveCount = isProxy(shallowReactiveCount);
const shallowReadonlyCount = shallowReadonly({ count: 0 });
const isProxyShallowReadonlyCount = isProxy(shallowReadonlyCount);
</script>
\ No newline at end of file
......@@ -151,7 +151,7 @@
{
name: 'isProxy',
url: 'is-proxy',
enable: false,
enable: true,
},
{
name: 'isReactive',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册