1. 安装jquery
npm install jquery --save
2.在配置文件vue.config.js中添加jquery 配置
先引入webpack,然后配置jQuery.如下: 这里仅展示jquery相关的
const webpack = require('webpack')module.exports = {publicPath: './',// 输出文件目录outputDir: 'dist',lintOnSave: true,configureWebpack: {plugins: [new webpack.ProvidePlugin({jQuery: 'jquery',$: 'jquery'})]},//...}
3.使用
直接在文件中使用jQuery 或 $ 即可
$('body').css("font-size", (12 * $(window).width() / 375) + "px")
