问题标签 [nuxt-plugin]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
autocomplete - 从组件访问 Nuxt.js 插件时,WebStorm 2021.3 显示“未解析的变量 $sdk”
我正在尝试在我的项目中使用 Nuxt.js 插件,但 WebStorm 无法正确识别插件公开的内容。
在我的例子中,它是一个 OpenAPI 客户端,并且在 WebStorm 中没有自动完成功能,我几乎无法使用它,而无需手动查找每个端点。
为了可视化问题,我创建了一个新项目作为复制器。
https://github.com/mklueh/nuxt-plugin-webstorm-autocomplete-reproducer
该插件只是公开了一个演示函数,我尝试从一个组件访问它。
我的插件.js
无论出于何种原因,我无法在此复制器项目中启用 Node.js 编码辅助,但在我的实际项目中,它已启用。所以我不确定这是否相关以及问题的原因。
我如何确保 WebStorm 找到 Nuxt.js 插件公开的内容?
vue.js - Nuxt - pusher:登录时刷新插件
对于我的 nuxt 应用程序,我需要使用 pusher 来处理 websocket。
我使用 pusher-js,并创建了一个 nuxt 插件来启用 pusher throughtout 我的应用程序。
问题是我需要授权才能使用推送器。我的插件:
这是我在 nuxt-config 中注册插件的地方
当我登录并刷新页面时,一切正常。但是当我通过登录页面登录时,推送器对象没有实例化(因为我没有登录),当我想去我的聊天页面时,网站没有刷新(导致 spa),我很明显得到一个错误原因我想访问推送器,但它不存在。
那么有没有办法在我登录时刷新插件,或者只有在我登录时才启用它?
谢谢 :)
javascript - 在 nuxtjs2 中将 javascript 类作为插件注入时出错
我正在尝试将 javascript 类作为插件注入。
我收到以下错误: 无法读取未定义的属性“日志”
要注入的类:
插入:
用法:
更新:
看起来插件在客户端创建的钩子中不可用,为什么?如果我将插件转换为服务器客户端插件,它就可以工作。
nuxt.js - How to disable NUXT module on specific pages?
I am using @nuxtjs/google-adsense
and @nuxtjs/i18n
Loading that modules in nuxt-config.js
How can I disable @nuxtjs/google-adsense
on some locals?
Adsense does not support one of my website's language and need to disable ads on that pages.
I can remove adsbygoogle
from pages but can't disable auto ads.