提交 1d6a604d 编写于 作者: H hdx

feat($parent): 放开入口,新增测试例子

上级 b9f1c40b
<template>
<view class="page">
<child></child>
<form>
<child ref="child"></child>
</form>
<view>
<button @click="testParent" class="call-parent-func">调用组件所在页面方法</button>
</view>
<view>
<text>{{parentValue}}</text>
</view>
</view>
</template>
<script>
import child from './child.uvue'
import child from './child.uvue'
export default {
components: {
child
},
data () {
return {
value: "parent"
}
},
methods: {
testFunction (): string {
return "parentFunctionResult"
export default {
components: {
child
},
data() {
return {
value: "parent",
parentValue: "123"
}
},
methods: {
testFunction() : string {
return "parentFunctionResult"
},
testParent() {
const child = this.$refs['child'] as ComponentPublicInstance
this.parentValue = child.$parent!.$callMethod('testFunction') as string
},
}
}
}
</script>
<style>
.page {
display: flex;
flex-direction: row;
justify-content: space-between;
}
</style>
</style>
\ No newline at end of file
......@@ -306,12 +306,7 @@
{
name: '$parent',
url: 'parent',
// #ifdef APP
enable: true,
// #endif
// #ifdef WEB
enable: false,
// #endif
},
{
name: '$root',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册