Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
886f8c9e
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
363
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看板
提交
886f8c9e
编写于
8个月前
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(component instance): emit function
上级
bd191fa4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
45 deletion
+31
-45
pages/component-instance/emit-function/emit-function-composition.uvue
...ent-instance/emit-function/emit-function-composition.uvue
+6
-13
pages/component-instance/emit-function/emit-function-options.uvue
...mponent-instance/emit-function/emit-function-options.uvue
+1
-1
pages/component-instance/emit-function/emit-function.test.js
pages/component-instance/emit-function/emit-function.test.js
+24
-31
未找到文件。
pages/component-instance/emit-function/emit-function-composition.uvue
浏览文件 @
886f8c9e
...
...
@@ -2,7 +2,7 @@
<view class="page">
<view class="row">
<text>子组件传的参数</text>
<text>
<text
id="value"
>
{{ value }}
</text>
</view>
...
...
@@ -13,18 +13,11 @@
<script setup lang="uts">
import child from './child-composition.uvue'
defineOptions({
data() {
return {
value: ''
}
},
methods: {
callback(str: string) {
this.value = str
}
}
})
const value = ref('')
const callback = (str: string) => {
value.value = str
}
</script>
<style>
...
...
This diff is collapsed.
Click to expand it.
pages/component-instance/emit-function/emit-function-options.uvue
浏览文件 @
886f8c9e
...
...
@@ -2,7 +2,7 @@
<view class="page">
<view class="row">
<text>子组件传的参数</text>
<text>
<text
id="value"
>
{{ value }}
</text>
</view>
...
...
This diff is collapsed.
Click to expand it.
pages/component-instance/emit-function/emit-function.test.js
浏览文件 @
886f8c9e
const
PAGE_PATH
=
'
/pages/component-instance/emit-function/emit-function-options
'
const
PAGE_COMPOSITION_PATH
=
'
/pages/component-instance/emit-function/emit-function-composition
'
describe
(
'
$emit()
'
,
()
=>
{
let
page
it
(
'
$emit() 选项式 API 事件生效
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
const
beforeValue
=
await
page
.
data
(
'
value
'
)
const
btn
=
await
page
.
$
(
'
.call-parent-btn
'
)
btn
.
tap
()
const
afterValue
=
await
page
.
data
(
'
value
'
)
expect
(
beforeValue
).
not
.
toBe
(
afterValue
)
})
it
(
'
$emit() 组合式 API 事件生效
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_COMPOSITION_PATH
)
await
page
.
waitFor
(
500
)
const
beforeValue
=
await
page
.
data
(
'
value
'
)
const
btn
=
await
page
.
$
(
'
.call-parent-btn
'
)
btn
.
tap
()
const
afterValue
=
await
page
.
data
(
'
value
'
)
expect
(
beforeValue
).
not
.
toBe
(
afterValue
)
})
})
const
PAGE_PATH
=
'
/pages/component-instance/emit-function/emit-function-options
'
const
PAGE_COMPOSITION_PATH
=
'
/pages/component-instance/emit-function/emit-function-composition
'
describe
(
'
$emit()
'
,
()
=>
{
const
test
=
async
(
path
)
=>
{
const
page
=
await
program
.
reLaunch
(
path
)
await
page
.
waitFor
(
'
view
'
)
const
valueText
=
await
page
.
$
(
'
#value
'
)
const
beforeValue
=
await
valueText
.
text
()
const
btn
=
await
page
.
$
(
'
.call-parent-btn
'
)
await
btn
.
tap
()
const
afterValue
=
await
valueText
.
text
()
expect
(
beforeValue
).
not
.
toBe
(
afterValue
)
}
it
(
'
$emit() 选项式 API 事件生效
'
,
async
()
=>
{
await
test
(
PAGE_PATH
)
})
it
(
'
$emit() 组合式 API 事件生效
'
,
async
()
=>
{
await
test
(
PAGE_COMPOSITION_PATH
)
})
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部