I was watching a tutorial that uses laravel and vue and on the tutorial he add a vue component in the components folder and then register that component in app.js
file using this code
Vue.component('articles',require('./components/articles.vue');
And it works fine and in my case when I use this code it says require is not defined
. In the app.js
file theres already an example component registered using this code
Vue.component('example-component',__webpack_require__(37));
My question is how does the number 37
define the ExampleComponent.vue
file? And how can I get the number of the file i want to include? And I don't have the webpack CLI Thanks
看来我在公共目录中使用了错误的app.js文件,应该将这些代码添加到位于组件目录中的app.js中
You should try
import YourComponent from 'path';
new Vue({
components: {
"your-component": YourComponent
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.