Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
b156149a
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
359
Star
3
Fork
8
代码
文件
提交
分支
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看板
提交
b156149a
编写于
4月 20, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(component instance): circular reference
上级
5b059fb3
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
134 addition
and
33 deletion
+134
-33
pages.json
pages.json
+8
-2
pages/component-instance/circular-reference/ChildA-composition.uvue
...onent-instance/circular-reference/ChildA-composition.uvue
+20
-0
pages/component-instance/circular-reference/ChildA-options.uvue
...component-instance/circular-reference/ChildA-options.uvue
+3
-3
pages/component-instance/circular-reference/ChildB-composition.uvue
...onent-instance/circular-reference/ChildB-composition.uvue
+20
-0
pages/component-instance/circular-reference/ChildB-options.uvue
...component-instance/circular-reference/ChildB-options.uvue
+3
-3
pages/component-instance/circular-reference/ChildC-composition.uvue
...onent-instance/circular-reference/ChildC-composition.uvue
+22
-0
pages/component-instance/circular-reference/ChildC-options.uvue
...component-instance/circular-reference/ChildC-options.uvue
+2
-2
pages/component-instance/circular-reference/circular-reference-composition.uvue
...ce/circular-reference/circular-reference-composition.uvue
+16
-0
pages/component-instance/circular-reference/circular-reference-options.uvue
...stance/circular-reference/circular-reference-options.uvue
+6
-11
pages/component-instance/circular-reference/circular-reference.test.js
...nt-instance/circular-reference/circular-reference.test.js
+22
-11
pages/index/index.uvue
pages/index/index.uvue
+12
-1
未找到文件。
pages.json
浏览文件 @
b156149a
...
...
@@ -456,9 +456,15 @@
}
},
{
"path"
:
"pages/component-instance/circular-reference/circular-reference"
,
"path"
:
"pages/component-instance/circular-reference/circular-reference
-options
"
,
"style"
:
{
"navigationBarTitleText"
:
"circular reference"
"navigationBarTitleText"
:
"循环引用 选项式 API"
}
},
{
"path"
:
"pages/component-instance/circular-reference/circular-reference-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"循环引用 组合式 API"
}
},
...
...
pages/component-instance/circular-reference/ChildA-composition.uvue
0 → 100644
浏览文件 @
b156149a
<template>
<view class="child-a">
<view class="flex justify-between flex-row mb-10">
<text>child A limit:</text>
<text>{{limit}}</text>
</view>
<child-b v-if="limit>1" :limit="limit-1" />
</view>
</template>
<script setup lang='uts'>
import ChildB from './childB-composition.uvue'
defineProps({
limit: {
type: Number,
default: 0
}
})
</script>
pages/component-instance/circular-reference/ChildA.uvue
→
pages/component-instance/circular-reference/ChildA
-options
.uvue
浏览文件 @
b156149a
...
...
@@ -4,16 +4,16 @@
<text>child A limit:</text>
<text>{{limit}}</text>
</view>
<child-b v-if="limit>1" :limit="limit-1"
></child-b
>
<child-b v-if="limit>1" :limit="limit-1"
/
>
</view>
</template>
<script lang='uts'>
import
childB from './childB
.uvue'
import
ChildB from './childB-options
.uvue'
export default {
components: {
c
hildB
C
hildB
},
props: {
limit: {
...
...
pages/component-instance/circular-reference/ChildB-composition.uvue
0 → 100644
浏览文件 @
b156149a
<template>
<view class="child-b">
<view class="flex justify-between flex-row mb-10">
<text>child B limit:</text>
<text>{{ limit }}</text>
</view>
<child-a v-if="limit > 1" :limit="limit - 1" />
</view>
</template>
<script setup lang="uts">
import ChildA from './childA-composition.uvue'
defineProps({
limit: {
type: Number,
default: 0
}
})
</script>
pages/component-instance/circular-reference/ChildB.uvue
→
pages/component-instance/circular-reference/ChildB
-options
.uvue
浏览文件 @
b156149a
...
...
@@ -4,16 +4,16 @@
<text>child B limit:</text>
<text>{{limit}}</text>
</view>
<child-a v-if="limit>1" :limit="limit-1"
></child-a
>
<child-a v-if="limit>1" :limit="limit-1"
/
>
</view>
</template>
<script lang='uts'>
import
childA from './childA
.uvue'
import
ChildA from './childA-options
.uvue'
export default {
components: {
c
hildA
C
hildA
},
props: {
limit: {
...
...
pages/component-instance/circular-reference/ChildC-composition.uvue
0 → 100644
浏览文件 @
b156149a
<template>
<view class="child-c">
<view class="flex justify-between flex-row mb-10">
<text>child C limit:</text>
<text>{{limit}}</text>
</view>
<child-c-composition v-if="limit>1" :limit="limit-1" />
</view>
</template>
<script setup lang="uts">
defineOptions({
name: "ChildCComposition"
})
defineProps({
limit: {
type: Number,
default: 0
}
})
</script>
pages/component-instance/circular-reference/ChildC.uvue
→
pages/component-instance/circular-reference/ChildC
-options
.uvue
浏览文件 @
b156149a
...
...
@@ -4,13 +4,13 @@
<text>child C limit:</text>
<text>{{limit}}</text>
</view>
<child-c
v-if="limit>1" :limit="limit-1"></child-c
>
<child-c
-options v-if="limit>1" :limit="limit-1" /
>
</view>
</template>
<script lang='uts'>
export default {
name: "
child-c
",
name: "
ChildCOptions
",
props: {
limit: {
type: Number,
...
...
pages/component-instance/circular-reference/circular-reference-composition.uvue
0 → 100644
浏览文件 @
b156149a
<template>
<view class="page">
<!-- #ifdef APP-ANDROID -->
<!-- TODO: ios & web 不支持 a b 互相引用 -->
<child-a :limit="5" />
<!-- #endif -->
<child-c :limit="5" />
</view>
</template>
<script setup lang='uts'>
// #ifdef APP-ANDROID
import ChildA from './childA-composition.uvue'
// #endif
import ChildC from './ChildC-composition.uvue'
</script>
\ No newline at end of file
pages/component-instance/circular-reference/circular-reference.uvue
→
pages/component-instance/circular-reference/circular-reference
-options
.uvue
浏览文件 @
b156149a
...
...
@@ -2,29 +2,24 @@
<view class="page">
<!-- #ifdef APP-ANDROID -->
<!-- TODO: ios & web 不支持 a b 互相引用 -->
<child-a :limit="5"
></child-a
>
<child-a :limit="5"
/
>
<!-- #endif -->
<child-c :limit="5"
></child-c
>
<child-c :limit="5"
/
>
</view>
</template>
<script lang='uts'>
// #ifdef APP-ANDROID
import
childA from './childA
.uvue'
import
ChildA from './childA-options
.uvue'
// #endif
import childC from './childC.uvue'
import childC from './childC
-options
.uvue'
export default {
components: {
// #ifdef APP-ANDROID
c
hildA,
C
hildA,
// #endif
childC
},
data() {
return {
text: ''
}
},
}
}
</script>
\ No newline at end of file
pages/component-instance/circular-reference/circular-reference.test.js
浏览文件 @
b156149a
const
PAGE_PATH
=
'
/pages/component-instance/circular-reference/circular-reference
'
const
OPTIONS_PAGE_PATH
=
'
/pages/component-instance/circular-reference/circular-reference-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/component-instance/circular-reference/circular-reference-composition
'
describe
(
'
circular-reference
'
,
()
=>
{
describe
(
''
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
})
if
(
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
().
includes
(
'
android
'
))
{
it
(
'
cross reference
'
,
async
()
=>
{
const
test
=
async
(
page
)
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
().
includes
(
'
android
'
))
{
// cross reference
const
childA
=
await
page
.
$$
(
'
.child-a
'
)
expect
(
childA
.
length
).
toBe
(
3
)
const
childB
=
await
page
.
$$
(
'
.child-b
'
)
expect
(
childB
.
length
).
toBe
(
2
)
})
}
}
it
(
'
reference self
'
,
async
()
=>
{
// reference self
const
childC
=
await
page
.
$$
(
'
.child-c
'
)
expect
(
childC
.
length
).
toBe
(
5
)
}
it
(
'
circular-reference options API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
})
it
(
'
circular-reference composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
})
})
\ No newline at end of file
pages/index/index.uvue
浏览文件 @
b156149a
...
...
@@ -382,7 +382,18 @@ export default {
{
id: 'circular-reference',
name: 'circular reference',
url: 'circular-reference/circular-reference'
children: [
{
id: 'circular-reference-options',
name: '循环引用 选项式 API',
url: 'circular-reference-options'
},
{
id: 'circular-reference-composition',
name: '循环引用 组合式 API',
url: 'circular-reference-composition'
},
]
}
] as Page[]
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录