I am trying to refactor an angular app to Vue in an asp.net mvc app. Following works:
<div id="app" style="margin-top:100px;">
{{message}}
</div>
<script>
const v = new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!'
}
})
</script>
However when I move the script to a javascript file it dosent work. I guess its some timing in loading the script. What is best practice here?
Layouts: I load following in the laysouts file:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<script src="~/Scripts/vue.js"></script>
<script src="~/app/main.js"></script>
</head>