is to use another component in a component to form a parent-child relationship
for example, using component2
component1 in component1 is the parent component of component2
component2 is a child component of component1
//component1.vue
<template>
<div>
<component2></component2>
</div>
<template>
...
import component2 from 'component2.vue'
@ Zany
I am a novice. Thank you for replying to me. Maybe I didn't read the official tutorial carefully enough or didn't quite understand your answer. Please see the example below.
<div id="app-4">
<div id="app-5" :style="{ fontSize: postFontSize + 'em' }" >
<blog-post3 v-for="post in posts" v-bind:post="post" v-bind:key="post.id" v-on:enlarge-text="postFontSize += 0.1 "> </blog-post3>
</div>
</div>
<script>
Vue.component('blog-post3', {
props: ['post'],
template: `
<div>
<h3> {{ post.title }}</h3>
<button v-on:click="$emit('enlarge-text')">enlarge text</button>
<div v-html="post.content"></div>
</div>`
});
var app4 = new Vue({
el: '-sharpapp-4',
data: {
posts: [
{ id: 1, title: 'My journey with Vue', content: '...content...' },
{ id: 2, title: 'Blogging with Vue', content: '...content...' },
{ id: 3, title: 'Why Vue is so fun', content: '...content...' }
],
postFontSize: 1
}
});
</script>
in this example, can it be understood that < div id= "app-4" > is the parent component and < blog-post3 > is its child component after app-4 instantiation.
if not, what is the component of the div you are talking about?
< hr >
<page-a> script <list>