将vue-cli读取的应用程序部署到Apache时出现问题

时间:2019-05-13 07:56:58

标签: apache webpack webdeploy vue-cli-3

我应该在哪里设置哪些选项,以便在运行“ npm run build”命令期间在资源路径中的SLASH之前自动设置DOT?

我已经使用vue-cli创建了应用程序,然后尝试将我的应用程序部署到Apache HTTP服务器。 我的动作: 1)npm运行构建 2)“ npm run serve”已正常运行我的应用程序! 3)转到Apache:将获得的“ dist”文件夹复制到Apache的“ https”文件夹 4)尝试运行应用“ http://localhost:8020/dist/” …但是我看到空白页,因为resurces(js,css,字体)尚未加载。 index.html资源中重新叙述的所有状态均为404。 资源的路径类似(斜杠前没有点)

public class Branch
{
    public string Id { get; set; }
    public string Name { get; set; }
    public ObservableCollection<Branch> Branches { get; set; }
}

对于所有资源,我都手动在斜杠前写了点:

public partial class MainWindow : Window
{
    public Branch Branch { get; set; }

    public MainWindow()
    {
        Branch = new Branch()
        {
            Id = "1",
            Name = "A",
            Branches = new ObservableCollection<Branch>()
            {
                new Branch()
                {
                    Id = "2",
                    Name = "B",
                    Branches = new ObservableCollection<Branch>()
                    {
                        new Branch()
                        {
                            Id = "3",
                            Name = "C",
                        },
                        new Branch()
                        {
                            Id = "3",
                            Name = "C",
                            Branches = new ObservableCollection<Branch>()
                            {
                                new Branch()
                                {
                                    Id = "3",
                                    Name = "C",
                                },
                                new Branch()
                                {
                                    Id = "3",
                                    Name = "C",
                                }
                            }
                        }
                    }
                },
                new Branch()
                {
                    Id = "2",
                    Name = "B",
                    Branches = new ObservableCollection<Branch>()
                    {
                        new Branch()
                        {
                            Id = "3",
                            Name = "C",
                        }
                    }
                }
            }
        };

        InitializeComponent();
        this.DataContext = this.Branch;
    }
}

…并且资源的loadig已完全通过,但页面仍然为空:frowning:因为输入脚本未启动 很长时间以来,我都在阅读手册和进行实验,因此,我在index.html中使用“ –modern”选项构建了App,出现的代码如下:

<script type=module src=/js/app.4dcb0a0b.js></script>

最后我的应用成功运行了

0 个答案:

没有答案