[英]How to use external custom element (plugin) in Aurelia app?
我已经在github仓库中定义了一个自定义元素。 然后,我将jspm install
到另一个应用程序中。
在其他应用程序中导入此元素的正确方法是什么? 当我在应用程序配置中调用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');
}
您放置的aurelia.use.plugin('[here]')
应该与您的jspm安装的匹配。
例如,如果包含您的插件的github存储库是https://github.com/uavalos/mega-plugin ,则可以执行jspm install github:uavalos/mega-plugin
来安装插件。 要加载插件,您需要编写aurelia.use.plugin('uavalos/mega-plugin')
。
如果您共享插件的网址,我可以提供更具体的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.