Vue项目中如何巧妙融合jQuery实现功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计125个文字,预计阅读时间需要1分钟。
1. 使用npm安装jQuery并保存: bash npm install jquery --save
2. 在webpack.base.config.js中添加配置: javascript module.exports={ context: path.resolve(__dirname, '..'), entry: { app: D:\\wamp\\www\\myapp\\index.js } }
1、npminstalljquery--save2、在webpack.base.config.js中添加module.exports{context:path.resolve(1、 npm install jquery --save
2、在webpack.base.config.js中添加
module.exports {context: path.resolve(__dirname, ../),entry: {app: ./src/main.js},......plugins: [new webpack.ProvidePlugin({jQuery: "jquery",jquery:"jquery",$: "jquery",“window.jQuery”:"jquery"})]}
3、若有eslint检查在.eslint.js中的module.export中添加
env: { // 原有browser: true, // 添加 jquery: true}
4、在main.js中导入jQuery
import jquery
本文共计125个文字,预计阅读时间需要1分钟。
1. 使用npm安装jQuery并保存: bash npm install jquery --save
2. 在webpack.base.config.js中添加配置: javascript module.exports={ context: path.resolve(__dirname, '..'), entry: { app: D:\\wamp\\www\\myapp\\index.js } }
1、npminstalljquery--save2、在webpack.base.config.js中添加module.exports{context:path.resolve(1、 npm install jquery --save
2、在webpack.base.config.js中添加
module.exports {context: path.resolve(__dirname, ../),entry: {app: ./src/main.js},......plugins: [new webpack.ProvidePlugin({jQuery: "jquery",jquery:"jquery",$: "jquery",“window.jQuery”:"jquery"})]}
3、若有eslint检查在.eslint.js中的module.export中添加
env: { // 原有browser: true, // 添加 jquery: true}
4、在main.js中导入jQuery
import jquery

