Javascript 导入Vue组件
我有一个Vue组件注册到:Javascript 导入Vue组件,javascript,laravel,vue.js,vue-component,Javascript,Laravel,Vue.js,Vue Component,我有一个Vue组件注册到: Vue.component('logo', function (resolve) {require(['./components/layout/Logo.vue'], resolve)}); 组件本身定义为: <template> <div> <div class="title"> <a href="/"> <h1>Welcom
Vue.component('logo', function (resolve) {require(['./components/layout/Logo.vue'], resolve)});
组件本身定义为:
<template>
<div>
<div class="title">
<a href="/">
<h1>Welcome to my Site!</h1>
</a>
</div>
<navigation></navigation>
</div>
</template>
<style scoped>
h1 {
text-decoration: underline;
text-align: center;
color: #000000;
}
</style>
<script>
import Navigation from './Navigation.vue';
export default {
data() {
return {
msg:'hello vue'
}
},
components: {
Navigation
}
}
</script>
当我用
Vue.component('navigation',function(resolve){require(['./components/layout/navigation.Vue'],resolve)})全局注册第二个组件时,也会发生同样的错误
是否使用该组件。Mywebpack.mix.js
包含:
mix.webpackConfig({
output: {
filename: "js/[id].js"
}
});
删除此项后,我能够正确加载。这是为了将输出的块文件移动到js/
目录,但显然是错误的
mix.webpackConfig({
output: {
filename: "js/[id].js"
}
});