nuxtjs引入jquery

2020-12-01 16:25:32

参考地址 nuxt引入jQuery库

nuxtjs如何添加 Webpack 插件?

方法一

       安装 jquery 包

npm install --save jquery


配置 nuxt.config.js

    const webpack = require('webpack')

module.exports = {    build: {        plugins: [            new webpack.ProvidePlugin({                '$' : 'jquery'             })        ]    },    plugins: [] }


组件中使用

mounted () {

    $("body").append("1");}


方法二:直接在 nuxt.config.js 中引入 jquery.min.js文件

head: {

    script: [        { src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' }    ]}

或者也可以在子组件内部引入。


  • 2021-04-25 09:53:18

    android debug速度特别慢有时候卡住

    一直提示定在 Starting LLDB server。可能的原因是 Android Studio编译速度太慢了,就会一直卡在Starting LLDB server。可以通过设置 Run/Debug Configurations ——> Debugger ——> Debug type 为 Java 跳过 C/C++的调试,起码实现对 Java 程序的调试

  • 2021-04-25 09:54:19

    sequelize 时区配置

    sequelize 默认情况下, 保存日期时会转换成 +00:00时区,