vue3-virtual-scroll-list icon indicating copy to clipboard operation
vue3-virtual-scroll-list copied to clipboard

How to catch an events that was emitted from an item component?

Open vvy6791 opened this issue 2 years ago • 3 comments

There the way exists for pass params TO items components via "source" item prop, or pass additional params to items components: via extra-props. But how to get BACK a data from an item components?

  1. How to catch an events that was emitted from an item component?
  2. How to get item component instance with an index or data-key specified? Or, for example, to detect is the item in the visible scroll area (get the items bound rect within the browser window)

vvy6791 avatar Oct 31 '22 15:10 vvy6791

你可以使用一个中间组件,不需要把需要渲染的组件传递给他 image image

good-ideal avatar Nov 01 '22 06:11 good-ideal

你可以使用一个中间组件,不需要把需要渲染的组件传递给他 I don't understand Сhinese, sorry. I tried to translate your answer, but it does not explain the attached pictures. I think, if you want, that most of people clear understand you, try write in English (it's not my native language too, but I do so).


If I clear uderstand your code on screens, you suggest to use a Vuex global store. This approach is not a good one, as I think. It breaks modularity and increases the connectivity of components. Vue recommends to use "props - emit" scheme to comunicate parent component with its children components. And I don't see how to use this scheme with this realization of Virtual Scroller.

vvy6791 avatar Nov 07 '22 17:11 vvy6791

你可以使用一个中间组件,不需要把需要渲染的组件传递给他 I don't understand Сhinese, sorry. I tried to translate your answer, but it does not explain the attached pictures. I think, if you want, that most of people clear understand you, try write in English (it's not my native language too, but I do so).

If I clear uderstand your code on screens, you suggest to use a Vuex global store. This approach is not a good one, as I think. It breaks modularity and increases the connectivity of components. Vue recommends to use "props - emit" scheme to comunicate parent component with its children components. And I don't see how to use this scheme with this realization of Virtual Scroller.

Hi @vvy6791 , find solution here: https://github.com/tangbc/vue-virtual-scroll-list/issues/237#issuecomment-641935872 both vue and vue3 have extra-props, it works for me

sy0uta1k0n avatar Dec 07 '22 06:12 sy0uta1k0n