Vue introduces plug-ins based on jQuery. Is there any way to introduce jQuery, locally but not globally?

Let"s talk about the situation first. The project wrote its own util.js tool file, and then introduced import $from "util", like this. I didn"t intend to use jQuery, at the beginning, so I used $;
but the later project used rich text, and then found a rich text plug-in vue-froala-wysiwyg, with good compatibility, but it was based on jQuery (the plug-in source code requires the $of jQuery).
so I"d like to ask if jQuery? can be introduced locally. Only the rich text plug-in can use jQuery. The technical team asked me to find a way to solve this problem. Don"t change import $from "util" to import util from" util"

.
Apr.16,2021

if it's a project built by vue-cli, it's OK to locally reference jq.


https://blog.csdn.net/jx95091.

you just replace the references in main.js with other js files, so that you don't have global references

.

should start with how vue-froala-wysiwyg uses $. I looked at the plug-in code and found that he uses $instead of window.$, which conflicts with the local import $from 'util.js'.

changing all $to window.$ in .node _ modules/vue-froala-wysiwyg/dist/vue-froala.js will not conflict, there is not much to change, in fact, it is only used to seemingly select elements.

after this change, other cooperation with you at the same time can not Synchronize .node _ modules code, or it is recommended that you localize the code of the vue-froala-wysiwyg plug-in.


directly

import jq from 'jQuery'

No problem.

Menu