[英]How to integrate an existing Vue.js 2 interface to an existing ASP.NET/C# Web forms application?
Yesterday I've received an interface made using Vue.js 2 and I've been asked to implement it to an existing C#/ASP.NET web forms application.昨天我收到了一个使用 Vue.js 2 制作的界面,我被要求将它实现到现有的 C#/ASP.NET Web 表单应用程序中。
I've noticed that vue.js can be used on the CLI/npm (which I believe the new interface is made of) and the easy import.我注意到 vue.js 可以在 CLI/npm(我相信新界面是由它组成的)和简单的导入上使用。
How should I go about this ?我应该怎么做? A schema of how things will be interacting with each other is appreciated!事物将如何相互作用的模式值得赞赏!
If you have access to the build output of the Vue.js UI it can be quite straight forward in ASP.NET MCV.如果您可以访问 Vue.js UI 的构建输出,那么在 ASP.NET MCV 中它可以非常简单。 I don't now how applicable to webforms it will be but here was my solution to the issue:我现在不知道它将如何适用于网络表单,但这是我对这个问题的解决方案:
@{
Layout = "~/Views/Shared/Layouts/_Public_Injectable.cshtml";
ViewBag.Title = "Page Title";
}
@section scripts{
@Styles.Render("~/content/css/vue")
}
<noscript>
<strong>We're sorry but this page doesn't work without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script src="~/Scripts/Vue-Build-Files/js/chunk-vendors.738367a5.js"></script>
<script src="~/Scripts/Vue-Build-Files/js/app.40933a0b.js"></script>
Essentially the solution is to take the Vue.JS build output and add it as a set of scripts to the page and ensure that your page has the necessary index.html to work with the vue application本质上,解决方案是将 Vue.JS 构建输出作为一组脚本添加到页面中,并确保您的页面具有必要的 index.html 以与 vue 应用程序一起使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.