N
N
nastya_zholudeva2018-03-09 16:12:48
Vue.js
nastya_zholudeva, 2018-03-09 16:12:48

How to make a click in one component cause a click in another component?

There is a Menu.vue component

<button class="text-size" id="little-letter" @click="setSizeText(-10)">A</button>

methods: {
    setSizeText (val) {
      this.$emit('sizeValue', val)
    }
  }

And there is a parent Reader.vue.
It is necessary that on click on the Menu.vue component (method setSizeText (val)) pass data to Reader.vue and there, for example, the on-click method that receives and uses this data works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lavezzi1, 2018-03-09
@nastya_zholudeva

A bit unclear. The menu component will be used in the reader component? If yes then like this:
reader.vue:

<menu @sizeValue="onSizeChange"></menu>

methods: {
  onSizeChange(value) {
    console.log(value);
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question