在Laravel 5.6中安装和使用Sweet Modal Vue npm软件包

So I have been searching through Stack Overflow and reading to the responses to similar questions as this but they have not helped me at all in better understanding this:

I wanted to use this Sweet Modal Vue package ( https://sweet-modal-vue.adepto.as/ ) for my Laravel 5.6 project (I am using the Laravel Homestead setup btw). Installed it via npm and it is contained within my node_modules folder.

Now I am trying to use it within my project. I have tried following the instructions on the documentation to no avail, after which I tried using

window.SweetModalVue = require('sweet-modal-vue');

in the app.js file first and then tried I tried using it in the bootstrap.js file. And after I compile and try inserting

<sweet-modal>Well Hello There</sweet-modal>

in my blade template code, I keep getting an error message of

ReferenceError: SweetModal is not defined

I don't see any tutorials at all (articles or video tutorials) on how this process works on Laravel 5.6. Could anyone let me know what I am doing wrong?

1个回答

You can install component globally

const SweetModal = require('sweet-modal-vue/plugin.js').default
Vue.use(SweetModal)

then in your code

<sweet-modal>Well Hello There</sweet-modal>
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐