question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarification needed on "Non Parent-Child Communication" in Guide

See original GitHub issue

http://rc.vuejs.org/guide/components.html#Non-Parent-Child-Communication

I tried implementing the above 2.0 example in a standalone web app:

Source: https://github.com/jvanbrug/vue-guide-examples/tree/master/09_Components/13_Non_Parent-Child_Communication

Live demo: https://jvanbrug.github.io/vue-guide-examples/09_Components/13_Non_Parent-Child_Communication/index.html

However, I am unsure where this code snippet should go:

// in component B's created hook
bus.$on('id-selected', function (id) {
  // ...
})

I’m likely missing something, but I don’t think the concept of a “hook” was properly motivated (or mentioned) before this point in the 2.0 Guide.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
LinusBorgcommented, Sep 20, 2016

don’t think the concept of a “hook” was properly motivated (or mentioned) before this point in the 2.0 Guide.

Hooks are explained here:

Vue.component('component-b', {
  template: '<span>A has{{ aWasClicked ? "" : " not"}} been clicked</span>',
  data: {
    aWasClicked: false
  },
  created() {
    bus.$on('id-selected', function (id) {
      // ...
    })
  }
})

For the future: Your issue is a usage/support question, and the issue tracker is reserved exclusively for bug reports and feature requests. Therefore I close this now.

We encourage you to ask questions on the forum or on gitter.

0reactions
chrisvfritzcommented, Nov 3, 2017

@EthraZa Check out our hackernews demo. 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

PARENT/CHILD COMMUNICATION
It is very important for parents to be able to communicate openly and effectively with their children. Open, effective communication benefits not.
Read more >
Indiana Parenting Time Guidelines - IN.gov
A court is not required to give a written explanation as to why a parent is awarded more time with the child than...
Read more >
dcl-faqs-effective-communication-201411.pdf
For additional clarification of IDEA terminology and requirements related to addressing the communication needs of students with disabilities, see Appendix ...
Read more >
Complying with COPPA: Frequently Asked Questions
A GUIDE FOR BUSINESS AND PARENTS AND SMALL ENTITY COMPLIANCE GUIDE. The following FAQs are intended to supplement the compliance materials ...
Read more >
Promoting Family Engagement: Communicating with Families
A great starting point in sharing information with families about their children's development is by inviting them to observe their children in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found