0

I'm using laravel 5.4, with webpack and vue. I'm not sure how to add new libraries to use in vue.

For example, I run

npm install --save jquery vue2-select

What do I need to do next? I need to add:

Import Selectize from 'vue2-selectize'

or

Require ('vue2-selectize')

In the

resources / assets / js / app.js

file or

resources / assets / js / bootstrap.js

?

Can someone help me with the correct order to work?

Thank you!

1 Answer 1

1

import or require do almost same thing. But import is more popular.

  1. npm install --save jquery vue2-selectize You should run this in your root folder and npm will place those packages in 'node_modules'. Then import command will look in 'node_modules' and load it to your file.
  2. import Selectize from 'vue2-selectize' in that file where you want to use Selectize.
  3. resources / assets / js / app.js yes, this is where your front-end app start from. In vue documentation you can read more about single file components
  4. watch this laracast series and may be some other. They are easy to follow.
Sign up to request clarification or add additional context in comments.

1 Comment

In my case, I discovered that I had a conflict problem. Thank you for your help! It worked for me when I used window.Selectize = require ('vue2-selectize');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.