[英]Unable to use standard Vue plugin with Nuxt
Trying to get the Dragabilly Vue plugin to work with my Nuxt app: https://www.npmjs.com/package/vue-draggabilly 试图让Dragabilly Vue插件与我的Nuxt应用程序一起使用: https ://www.npmjs.com/package/vue-draggabilly
I've used the usual approach that has worked with similar plugins but I don't have the depth of knowledge to crack this one. 我使用了与类似插件兼容的常用方法,但是我没有足够的知识来破解这一插件。 I am adding into my nuxt config file:
我要添加到我的nuxt配置文件中:
plugins: [ { src: '~/plugins/vue-draggabilly.js', ssr: false } ]
That file includes this code: 该文件包含以下代码:
import Vue from 'vue'
import VueDraggabilly from 'vue-draggabilly'
Vue.use(VueDraggabilly)
However, I get the following error and I'm not able to use: 但是,出现以下错误,我无法使用:
vue-draggabilly.js:3 Uncaught ReferenceError: exports is not defined vue-draggabilly.js:3未捕获的ReferenceError:未定义导出
This refers to this line in the plugin: 这是指插件中的这一行:
exports.install = function (Vue, options) { ....
It is a usual vuew plugin package, but I'm not sure how to get it to work with nuxt. 这是一个常用的vuew插件程序包,但是我不确定如何使其与nuxt一起使用。 Any help very greatly appreciated!
任何帮助非常感谢!
I see a warning: 我看到一个警告:
warning in ./plugins/vue-draggabilly.js
./plugins/vue-draggabilly.js中的警告
4:8-22 "export 'default' (imported as 'VueDraggabilly') was not found in 'vue-draggabilly'
4:8-22“在'vue-draggabilly'中找不到导出的'默认'(导入为'VueDraggabilly')
I don't know the best answer, but this seems to work: 我不知道最佳答案,但这似乎可行:
import Vue from 'vue'
import * as VueDraggabilly from 'vue-draggabilly'
Vue.use(VueDraggabilly)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.