【问题标题】:Aurelia Webpack Router Error when using <form> Element in View在视图中使用 <form> 元素时出现 Aurelia Webpack 路由器错误
【发布时间】:2021-05-17 00:36:29
【问题描述】:

所以我对使用 Aurelia.io 比较陌生,我偶然发现了一个错误。 由于我已经在我的应用程序中实现了一个路由器,一旦我在我的视图中定义了一个 &lt;form&gt; 元素,我就会在我的浏览器中得到以下错误代码:

ERROR [app-router] Error: Error invoking Form. Check the inner error for details.
------------------------------------------------
Inner Error:
Message: too much recursion
Inner Error Stack:
Container.prototype._get@webpack-internal:///3U8n:532:41
Container.prototype._get@webpack-internal:///3U8n:538:32
Container.prototype._get@webpack-internal:///3U8n:538:32
Container.prototype._get@webpack-internal:///3U8n:538:32

我的 Form.html 如下所示:

   <div id="formcontainer">

      <form>

        <!--Vorname-->   
        <div class="wrapper">
          <div class="input-data">
              <input type="text" value.bind="Applicant.Name & validate" required>
              <div class="underline"></div>
              <label>Name</label>
          </div>
        </div>

        <!--Nachname-->   
        <div class="wrapper">
          <div class="input-data">
              <input type="text" required>
              <div class="underline"></div>
              <label>Family Name</label>
          </div>
        </div>
        
      </form>
   </div>

没有&lt;form&gt; 元素一切正常。

Form.html 通过路由显示在我的 app.html 中:

<template>
  
  <router-view></router-view>
</template>

我的带有路由器配置的 app.ts 如下所示:

export class App {
  router: any;

  configureRouter(config, router) {
    this.router = router;
    config.title = 'Aurelia';
    config.map([
      { route: ['', 'Form'],       name: 'Form', moduleId: PLATFORM.moduleName('Form/Form') ,title: 'ApplicationProcess' },
      { route: 'Confirmation',       name: 'Confirmation', moduleId: PLATFORM.moduleName('Confirmation/Confirmation') ,title: 'Sending Confirmed' }
    ]);
  }

}

提前致谢;)

【问题讨论】:

    标签: typescript webpack aurelia


    【解决方案1】:

    我的猜测是您的 Form.js 中有一些东西是由更改事件或加载的东西触发的。这通常不会导致错误。

    您介意发布一个代码笔或我们可以使用的东西吗?

    当一个 JS 函数以递归方式触发太多次时,会发生太多递归错误。

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Too_much_recursion

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-25
      • 2015-04-18
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多