duanmibei1929 2018-07-23 01:56
浏览 113

在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条回答 默认 最新

  • dqkv0603 2018-07-23 02:19
    关注

    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>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试