C
C
Camaro672018-10-31 16:06:40
JavaScript
Camaro67, 2018-10-31 16:06:40

How to properly pair jquery plugins with vue.js?

Hello! I recently started working with vue and ran into the problem that jquery plugins don't get along well with vue. While studying vue, I learned that plugins need to be initialized in mounted i.e. after mounting the vue instance. But in mounted it is not always convenient to do this. For example, the plugin should be on all pages. Do not specify it in each mounted? Previously, it would simply be initialized in the main script, which is connected to all pages. I feel that I have some wrong approach to vue. I didn’t find any global hooks in this regard in the documentation, but what comes to mind looks more like some kind of crutches. Please help me point me in the right direction :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sedyshev, 2018-10-31
@Camaro67

I just write wrappers for jquery plugins.
Example from official documentation: https://vuejs.org/v2/examples/select2.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question