Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of Javascript grandson Communication and component self-calling

Shulou Source: shulou.com Published: 2022-06-01 02:55:29 10月01日 Update

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.

Tags: Components communications methods knowledge content articles value hello easy to operate data articles easy to understand more news grandpa look industry views information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Apple NVidia Microsoft Huawei