首页 > 解决方案 > Edge 不允许 vue.js 作为 asp.net MVC 的模块工作

问题描述

我创建了一个最能代表我的设置的最小复制:

_emptyLayout.cshtml

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon"
          type="image/png"
          href="/Content/images/favicon.ico" />
    <title>@ViewBag.Title</title>
</head>
<body>
    @RenderBody()
</body>
</html>

数据控制器.cs

[Authorize(Users = "DataReader")]
public class DataController : Controller
{
    public ActionResult windex()
    {
        return View();
    }

    public ActionResult Index()
    {
        return View();
    }
}

windows.cshtml

@{
    ViewBag.Title = "windex";
    Layout = "~/Views/Shared/_emptyLayout.cshtml";
}

<h2>windex</h2>
<div id="app">
    {{msg}}
</div>
<script src="~/Scripts/data.js" type="module"></script>

数据.js

import Vue from 'https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.esm.browser.js'

export default new Vue(
    {
        el: '#app',
        data: {msg:'hi there'}
    });

基本上,当 Edge 呈现页面时,我会看到“{{msg}}”。当 Firefox 呈现页面时,我看到“你好”。

没有错误消息或警告。

纯 html 页面似乎不存在该问题。例如,我尝试使用堆栈片段复制问题,但 Edge 显示“你好”。

此外,如果我不使用模块,只使用常规脚本标签,它在 Edge 中也能很好地呈现。

以前有没有人遇到过这种技术组合的问题?有没有办法解决它?

标签: javascriptasp.net-mvcvuejs2microsoft-edgees6-modules

解决方案


推荐阅读