簡體   English   中英

沒有為元素定義 Aurelia API:

[英]No Aurelia APIs are defined for the element:

介紹

所以我是第一次在 Aurelia 上工作,並收到了客戶的一個項目。

據說 1 個月前一切正常,但現在我收到錯誤消息。

No Aurelia APIs are defined for the element: "O-SCHEMA-ACTION".

導致錯誤的行如下:

<o-schema-action show-as-popup.bind="false" repeat.for="a of actionGroup" 
item.bind="a" view-model.ref="this"></o-schema-action>

有誰知道是什么導致了這種情況?

數組actionGroup.有值actionGroup.

例外

aurelia-task-queue.js:56 Uncaught Error: No Aurelia APIs are defined for the element: "O-SCHEMA-ACTION".
    at getAU (aurelia-binding.js:5329)
    at Function.locateAPI (aurelia-binding.js:5356)
    at NameExpression.createBinding (aurelia-binding.js:5346)
    at applyInstructions (aurelia-templating.js:2467)
    at ViewFactory.create (aurelia-templating.js:2682)
    at BoundViewFactory.create (aurelia-templating.js:2562)
    at Repeat.addView (repeat.js:269)
    at ArrayRepeatStrategy._standardProcessInstanceChanged (array-repeat-strategy.js:111)
    at ArrayRepeatStrategy.instanceChanged (array-repeat-strategy.js:35)
    at Repeat.itemsChanged (repeat.js:160)

...

index.js:116 Uncaught Error: Uncaught Error: No Aurelia APIs are defined for the element: "O-SCHEMA-ACTION".
    at window.onerror (index.js:116)

HTML

<template>
    <c-page data-label.bind="action.groupLabel | humanize">
        <c-form>
            TESTING

            <o-form-schema action-controller.bind="actionController" root.bind="root" action.bind="action" filter-by="name !=='results'">

                <c-actions>
                    <li>
                        <button as-element="c-trigger" data-decorator="d-as-button t-error-dark-boxed" click.delegate="cancel()">CANCEL</button>
                    </li>

                    TODO: ISSUE HERE WITH BUTTONS
                    <o-schema-action show-as-popup.bind="false" repeat.for="a of actionGroup" item.bind="a" view-model.ref="this"></o-schema-action>

                </c-actions>

            </o-form-schema>

        </c-form>
    </c-page>
</template>

打字稿/JS

export class Action {

     @bindable actionGroup = null;
   @bindable action = null;
        groupId = null;
        @bindable root = null;



    constructor() {}

    determineActivationStrategy() {
        return activationStrategy.invokeLifecycle;
        }

 cancel() {

    }

    activate(params, routeConfig) {
        this.groupId = params.id;
        Configuration.load().then(ret => {

            let clone = JSON.parse(JSON.stringify(ret));
            this.root = clone;
            this.actionGroup = this.buildGroup(clone.actions, this.groupId);
            this.action = this.actionGroup[0];
        });
    }

    buildGroup(actions, groupId) {
        let ret = actions.filter(a => CONDITION );
        ret.forEach(a => {
            // NOT RELEVANT TO SHOW THIS ( it works ) ... 
        });
        return ret;
    }


}

初步答復

我剛注意到...

一個月前,我們有兩個文件:

o-schema-action.js

o-schema-action.html

這些文件似乎已被刪除。

更新

我剛剛又遇到了一個不同的錯誤:

No Aurelia APIs are defined for the element: "AB-SELECTOR".

當特定元素缺少文件時,似乎會引發此錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM