【发布时间】:2016-03-24 15:58:04
【问题描述】:
我正在尝试将 Selectize 与 aurelia 一起使用并不断收到错误消息:
Uncaught (in promise) TypeError: $(...).selectize is not a function(...)
我通过 index.html 中的脚本标签加载了 jquery,并尝试在一个简单的组件中加载 selectize:
EventForm.html
<template>
<div>
<label for="eventTitle">Title</label>
<input type="text" id="eventTitle">
</div>
<div>
<label for="eventType">Sport</label>
<select id="eventType">
<option>Event 1</option>
<option>Event 2</option>
<option>Event 3</option>
</select>
</div>
</template>
EventForm.js
'use strict';
import 'jspm_packages/github/selectize/selectize.js@0.12.1/dist/js/standalone/selectize';
export class EventForm {
constructor(){
}
attached() {
$('#eventType').selectize({
create: true,
sortField: {
field: 'text',
direction: 'asc'
},
dropdownParent: 'body'
});
}
}
index.html
.
.
.
<script type="text/javascript" src="jspm_packages/system.js"></script>
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript" src="jspm_packages/npm/jquery@2.2.1/dist/jquery.min.js"></script>
.
.
.
我感觉这与加载 systemjs 有更多关系,但我尝试在 index.html 中加载 selectize,结果相同。有人可以帮助指出我做错了什么吗?使用 jquery 2.2.1
谢谢
【问题讨论】:
标签: jquery aurelia systemjs selectize.js