W
W
wufapexef2018-03-29 00:54:58
Vue.js
wufapexef, 2018-03-29 00:54:58

Is it possible to access this.$refs from another component?

The Isotope plugin uses this
this.$refs.cpt.filter(key)
. But I need to move the navigation to a separate component. How to execute this code from it if the plugin is in another component?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2018-03-29
@kulakoff Vue.js

Alternatively, make a method in the component that calls this.$refs.cpt.filter(key) and make a call from it:

methods: {
  someMethod() {
   // ...
   this.$refs.cpt.filter(key)
  }
}

Next, call this method from another component:
this.$refs.someComponent.someMethod()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question