How to integrate ASP.NET MVC Core with Vue.js?

Asked

Viewed 620 times

1

I have a project that requires the client side to use Vue.js to render the application views, but on the server side ASP.NET MVC Core is intended to validate all business rules.

Is there any way to integrate both technologies?

  • This link can help you: https://blog.kloud.com.au/2017/02/14/running-vuejs-on-aspnet-core-apps/

2 answers

1

The simplest and least "wilful" way is to pass the JSON from the object to the view.

for example:

<script>
        var app = new Vue({
            el: '#clienteForm',
            data:  @Json.Serialize(Model)
        })
</script>

Now your object Vue has all model data

The other option is to make your Vue to make ajax requests to a Webapi that returns the Jsons for the objects.

0

Hello, one way would be to use Asp.net core to serve as a Rest api, and use vuejs only for a front end, in my opinion is the best way.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.