2015-10-10 52 views
1

我已經在github回購中定義了一個自定義元素。我然後jspm install'd在另一個應用程序中說元素。如何在Aurelia應用程序中使用外部自定義元素(插件)?

在其他應用程序中導入此元素的正確方法是什麼?當我在應用程序配置中調用aurelia.use.plugin('aurelia-custom-element')時,它說它找不到aurelia-custom-element.js

奧裏利亞定製-element.html:

<template> 
<div>Hello world, from Aurelia custom element!</div> 
</template> 

奧裏利亞定製-element.js:

import {customElement, bindable} from 'aurelia-framework'; 

@customElement('aurelia-custom-element') 
export class AureliaCustomElement { 
} 

index.js:

export * from './aurelia-custom-element'; 

export function configure(config){ 
    config.globalResources('./aurelia-custom-element'); 
} 

回答

1

什麼你把aurelia.use.plugin('[here]')應該匹配你安裝的jspm。

例如,如果包含插件的github回購是https://github.com/uavalos/mega-plugin,那麼您將執行jspm install github:uavalos/mega-plugin來安裝該插件。加載你寫的插件aurelia.use.plugin('uavalos/mega-plugin')

如果你分享你的插件的網址,我可以提供更具體的幫助。

+0

沒有,沒有做到這一點。我不能分享代碼,因爲它是一個私人回購,但它實際上是上面顯示的代碼。我更新了'use.plugin',但它仍然找不到文件 –

+0

其實,我認爲這可能已經成功了。我似乎有問題瓦特/主機應用程序 –

+0

不是應用程序工作正常,但它仍然沒有加載插件 –

相關問題