I have downloaded some HTML template that comes with custom js files and jquery. I had to attach those js to my app. and continue with Vue.
I tried many ways to add the them but still have error:
enter image description here The folders in my projects :
The ways i tried :
I can not find the problem!
-
Save yourself some headache - when using Vue, do not mix anything based on jQuery. There are lots of of good Vue native components for almost anything....Michal Levý– Michal Levý2021年07月28日 07:50:11 +00:00Commented Jul 28, 2021 at 7:50
-
There is a package available. See my answer below.Peter Pointer– Peter Pointer2021年07月28日 07:51:08 +00:00Commented Jul 28, 2021 at 7:51
2 Answers 2
You should put this scripts not to src but to public folder and use static path 'static/content/...' or 'public/content/...' or better process.env.PUBLIC_URL + 'content/...' depends on your build config.
6 Comments
You want to import the module like any other. See package documentation:
https://www.npmjs.com/package/vue-owl-carousel2
Installation
npm i -s vue-owl-carousel2
or
yarn add vue-owl-carousel2
Usage
import carousel from 'vue-owl-carousel2'
export default {
components: { carousel },
}
Basic Usage
<carousel>
<img src="https://placeimg.com/200/200/any?1">
<img src="https://placeimg.com/200/200/any?2">
<img src="https://placeimg.com/200/200/any?3">
<img src="https://placeimg.com/200/200/any?4">
</carousel>