[英]Materialize-css javascript functions not found in Aurelia project
我創建了一個自定義屬性來控制materilaize select
元素的生命周期:
import {customAttribute} from 'aurelia-templating';
import {inject} from 'aurelia-dependency-injection';
@customAttribute('material-select')
@inject(Element)
export class MaterialSelect {
element: Element = null;
constructor(element) {
this.element = element;
}
attached() {
console.log("ATTACHED");
console.log(`The attached element is: ${this.element}`);
$(this.element).material_select();
}
detached() {
console.log("DETACHED");
$(this.element).material_select('destroy');
}
}
此外,我還安裝了materialize-css:
jspm install npm:materialize-css
...並且我已經在main.ts
導入了:
import materialize from 'materialize-css';
但是,每當具有material-select
屬性的元素嘗試加載時,我都會得到以下控制台輸出:
ATTACHED
The attached element is: [object HTMLSelectElement]
Uncaught TypeError: $(...).material_select is not a function
如何從Aurelia中識別出materialize-css javascript函數?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.