The method of Javascript grandson Communication and component self-calling
This article mainly introduces the relevant knowledge of Javascript grandson communication and component self-calling method, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this Javascript grandson communication and component self-calling method article. Let's take a look.
1. The component calls itself.
Parent component
Import DetailList from'. / detailList.vue'export default {components: {DetailList}, data () {return {categoryList: [{title:'1'}, children: [{title:'1-1'}, {title:'1-2'} ]}, {title: '2percent, children: [{title:' 2-1'}, {title:'2-2'},]}
Sub-component
{{item.title}} export default {name: 'DetailList', / / component naming props: {list: Array,}, data () {return {}},}
Master and grandson correspondence
Grand.vue
Import DetailList from'. / detailList.vue'export default {components: {DetailList}, data () {return {categoryList: [{title:'1'}, children: [{title:'1-1'}, {title:'1-2'} ]}, {title: '2percent, children: [{title:' 2-1'}, {title:'2-2'},]}
Father.vue
{{item.title}} export default {name: 'DetailList', / / component naming props: {list: Array,}, data () {return {}},}
Chidren.vue
? grandpa
Reply from GrandSon: {{reply}} import Father from'. / father.vue'export default {components: {Father}, data () {return {msg1:'1 ️"I am GrandFather, send the second message to GrandSon', msg2:'2 ️please GrandSon Hello I am GrandFather', reply:''/ / receive messages from GrandSon}}, methods: {/ * bind the obtained data to data to facilitate visual layer rendering * / getReply (param) {this.reply = param} about "Javascript grandson communication and component self-calling methods" this article is introduced here, thank you for reading! I believe you all have a certain understanding of "Javascript master-grandson communication and component self-calling methods". If you want to learn more, you are welcome to follow the industry information channel.