I am working on a project in .NET with MVC and Vue .js, when I want to use the components I have to declare them in the following way:
import Vue from 'vue';
import example from './components/example.vue'
import hello from './components/hello.vue'
import equiposcrear from './components/equipos/crear.vue'
import equipos from './components/equipos/index.vue'
import cargardiesel from './components/equipos/cargarDiesel.vue'
const app = new Vue({
el: '#app',
components: {
example,
equiposcrear,
equipos,
cargardiesel
}
})
If I put it as
Vue.component('equipos', require('./components/equipos/index.vue'));
at the moment you want to use <equipos></equipos>
tells me that the component is not declared.
@{
ViewBag.Title = "Equipos";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="app">
<equipos></equipos>
</div>
So I have the file webpack.config
module.exports = {
entry: "./Vue/app.js",
output: {
path: __dirname,
filename: "./Scripts/app.js",
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.min.js'
}
},
module: {
loaders: [
{ test: /\.vue$/, loader: 'vue-loader' },
],
}
}
Someone who can guide me? Thanks