无法从 AngularJS index.html 导航到 VueJS webapp

Unable to navigate to a VueJS webapp from AngularJS index.html

我试图将 AngularJS 和 VueJS 项目合并在一起,因为我们需要从 AngularJS 应用程序内部调用 VueJS 中设计的流程。为了将 AngularJS 和 VueJS 项目合并在一起,我将 Angular 和 Vue 的 package.json 文件中的依赖项和其他一些文件也包含在一起。

现在,由于 Vue 和 Angular 都在项目根目录中创建了一个 index.html 文件,我将 Angular 作为我的 index.html 文件并重命名为 VueJS索引文件为 index23.html。然后从我需要调用 VueJS 流程的 link,我在 AngularJS 配置文件的路由器中提供了路径,如下所示:

'use strict';

app.config(function ($routeProvider) {
    $routeProvider
        .when("/errorinput", {
            templateUrl: "src/index23.html"
        });
});


app.controller('ErrorInputCtrl', ['$scope', '$http', function ($scope, $http) {
 // Implement me!
}]);

但是在这样做时,我的 VueJS 页面没有出现,而是出现在背景中,我认为当前页面在单击 link 时被白色背景包围。我真的不确定是否需要在上述文件的 app.controller 方法中编写一些代码,因为这是我正在谈论的 Vue 组件。

我们有什么方法可以让它发挥作用吗?如果我需要提供更多详细信息,请告诉我。进行此调用的 index.html 文件的内容如下:

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>SEW Drive Status| </title>

    <!-- Bootstrap -->
    <link href="node_modules/gentelella/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="node_modules/gentelella/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="node_modules/gentelella/build/css/custom.min.css" rel="stylesheet">

    <!-- Angular JS Material -->
    <link href="node_modules/angular-material/angular-material.min.css" rel="stylesheet">
    <!-- Angular JS Material -->
    <!--link href="public/material.css" rel="stylesheet"-->

  </head>
    <script src="node_modules/angular/angular.min.js" ></script>
    <script src="node_modules/angular-route/angular-route.min.js" ></script>
    <script src="node_modules/angular-aria/angular-aria.min.js"></script>
    <script src="node_modules/angular-material/angular-material.min.js"></script>

    <script src="app/app.js" ></script>
    <!-- custom control script section -->
    <script src="app/components/assetlist.js" ></script>
    <script src="app/components/errorinput.js" ></script>
    <script src="bundle.js"></script>

                      <li><a><i class="fa fa-edit"></i>Administration<span class="fa fa-chevron-down"></span></a>
                        <ul class="nav child_menu">
                          <li><a href="#!errorinput"><i class="fa fa-database"></i>Manage Error Descriptions</a></li>
                        </ul>
                      </li>
                    </ul>
                  </div>
                </div>
                <!-- /sidebar menu -->

这是我需要调用 VueJS 应用程序的 Angular 页面和 link(管理错误描述):

白底问题:

errorinput.js文件添加代码后:

     'use strict';

app.config(function ($routeProvider) {
    $routeProvider
        .when("/errorinput", {
            templateUrl: "views/errorinput.html"
        });
});


app.controller('ErrorInputCtrl', ['$scope', '$http', function ($scope, $http) {
 // Implement me!
 <template>
    <div class="container">
        <div>
            <transition name="fade">
                <router-view></router-view>
            </transition>
        </div>
    </div>
</template>

<style>
    .fade-enter-active, .fade-leave-active {
      transition: opacity .5s
    }
    .fade-enter, .fade-leave-active {
      opacity: 0
    }
</style>

<script>

    export default{
    }
</script>
}]);

Vue 和 Angular 可以在一个页面上共存。

因为您正在使用 Angular 来呈现 Vue 的 HTML,您需要确保在呈现新的 HTML 之后触发您的 Vue 初始化。您可以通过几种方式完成此操作:

  1. 将您的 Vue 脚本粘贴到上面代码中 // Implement me 的位置
  2. 在您的 Angular 路由器中使用挂钩在路由加载后加载您的 Vue 特定 .js 文件

第一个选项可能性能更高,而第二个选项可能会使您的开发设置更干净。