Vue.js 如何在父组件中呈现子组件?
起始情况: 父组件(Parent.vue):Vue.js 如何在父组件中呈现子组件?,vue.js,Vue.js,起始情况: 父组件(Parent.vue): ........ 导出默认值{ 姓名:“家长” ........... 是的,没错。你试过了吗?不起作用吗? <template> ........ </template> <script> export default { name: 'Parent' ........... </script <template> ........ </template> <scrip
........
导出默认值{
姓名:“家长”
...........
是的,没错。你试过了吗?不起作用吗?
<template>
........
</template>
<script>
export default {
name: 'Parent'
...........
</script
<template>
........
</template>
<script>
export default {
name: 'Child'
...........
</script
<template>
<!--step 3:
use the Child component tag(<Child> custom element) in the parent component template
-->
<Child></Child>
</template>
<script>
//step 1: Import the Child component to the parent component
import Child from "@/path/to/Child.vue";
export default {
name: 'Parent',
//Declare the components object
components: {
//step 2: Declare/Register your child components here
Child // Child is the child component
}
}