[英]Vue 2.0 + webpack use component from npm package
I am trying to get a project using webpack and Vue 2.0 set up and ran into a little trouble using components from npm packages (like vue-parallax) in my project. 我试图使用webpack和Vue 2.0建立一个项目,并在我的项目中使用npm包中的组件(例如vue-parallax)遇到了一些麻烦。
I installed the package and everything appears to be there, but I'm not understanding where that is linked in my project. 我安装了该软件包,一切似乎都在那里,但是我不明白在我的项目中链接的位置。
What I think I'm missing is the import statement for 'parallax' in the script tag, but obviously that's just an educated guess. 我想我缺少的是script标记中的“视差”导入语句,但是显然这只是有根据的猜测。
Any help would be greatly appreciated. 任何帮助将不胜感激。
<template>
<div id="app">
<img src="./assets/logo.png">
<hello></hello>
<parallax src=require('../assets/logo.png')></parallax>
</div>
</template>
<script>
import Hello from './components/Hello'
//import parallax ?
export default {
name: 'app',
components: {
Hello,
parallax
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
per Belmin Bedak's comment: 根据Belmin Bedak的评论:
it's probably placed under the node_modules directory, so you can import it from there - try this 它可能放在node_modules目录下,因此您可以从那里导入它-试试这个
import parallax from 'vue-parallax'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.