In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you whether jquery can be cited in the vue project. I hope you will get something after reading this article. Let's discuss it together.
Jquery can be cited in the vue project, the introduction method is: 1, modify package.json;2, enter npm install in the terminal, import dependency; 3, modify webpack.base.conf;4, introduce jquery in the component.
This article operating environment: windows7 system, jquery2.2.3 version, DELL G3 computer
Introducing JQuery into vue projects
When you need to introduce JQ after successfully building a project with the vue-cli scaffolding tool, you can use the following methods:
Modify package.json
First add "jquery" to the dependencies in package.json: "^ 2.2.3"
Of course, you can modify the version you want to introduce, which introduces 2.2.3 here.
Import dependency
Enter npm install in the terminal to import the dependency.
Modify webpack.base.conf
The code is as follows. See the figure to modify it.
Var webpack = require ("webpack") plugins: [new webpack.ProvidePlugin ({$: "jquery", jQuery: "jquery", "windows.jQuery": "jquery"})]
Introduce jquery into the component to use
In which component we want to use the jQuery library, we first introduce jquery with the following command, and then we can use it normally.
Here we make a global introduction in main.js.
Import $from 'jquery'
The test uses:
Restart the application first: npm run dev refreshes the page
After reading this article, I believe you have a certain understanding of "can you introduce jquery in the vue project". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 272
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.