Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
aa730afa
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
401
Star
3
Fork
10
代码
文件
提交
分支
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看板
提交
aa730afa
编写于
9月 28, 2023
作者:
H
hdx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v-if): 增加一个简单例子,包含子元素且有大小
上级
3fdeeb7d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
1 deletion
+30
-1
pages/directive/v-if/v-if.test.js
pages/directive/v-if/v-if.test.js
+11
-0
pages/directive/v-if/v-if.uvue
pages/directive/v-if/v-if.uvue
+19
-1
未找到文件。
pages/directive/v-if/v-if.test.js
浏览文件 @
aa730afa
...
...
@@ -43,4 +43,15 @@ describe('v-if', () => {
const
element_not_abc
=
await
page
.
$
(
'
.text-not-a-b-c
'
)
expect
(
await
element_not_abc
.
text
()).
toBe
(
'
Not A/B/C
'
)
})
it
(
'
remove-children
'
,
async
()
=>
{
const
child_a
=
await
page
.
$
(
'
.child-a
'
)
expect
(
await
child_a
.
text
()).
toBe
(
'
child-a
'
)
const
btn_view
=
await
page
.
$
(
'
.btn-remove-chilren
'
)
await
btn_view
.
tap
()
await
page
.
waitFor
(
50
)
const
child_a2
=
await
page
.
$
(
'
.child-a
'
)
expect
(
child_a2
).
toBe
(
null
)
})
})
\ No newline at end of file
pages/directive/v-if/v-if.uvue
浏览文件 @
aa730afa
...
...
@@ -18,6 +18,13 @@
<text class="text-not-a-b-c">Not A/B/C</text>
</view>
<view class="btn-view view-click-abc" @click="switchABC">Switch A/B/C</view>
<view class="children">
<view v-if="showChildren">
<view class="child-a">child-a</view>
</view>
</view>
<view class="btn-view btn-remove-chilren" @click="removeChilren">removeChilren</view>
</view>
</template>
...
...
@@ -28,7 +35,8 @@
data() {
return {
show: true,
type: 'A'
type: 'A',
showChildren: true
}
},
methods: {
...
...
@@ -42,7 +50,17 @@
}
this.type = TypeList[typeIndex]
},
removeChilren() {
this.showChildren = false
}
}
}
</script>
<style>
.child-a {
width: 100px;
height: 100px;
}
</style>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录