将 selectize.js 与 Aurelia 和 systemjs 一起使用
using selectize.js with Aurelia and systemjs
我正在尝试将 Selectize 与 aurelia 一起使用,但一直出现错误:
未捕获(承诺)类型错误:$(...).selectize 不是函数(...)
我有 jquery 正在通过 index.html 中的脚本标记加载,并试图在一个简单的组件中加载 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
:
关于selectize
:只需检查config.js
中的地图进行选择,我想你需要像import "selectize"
或import "selectize.js"
一样导入它
我正在尝试将 Selectize 与 aurelia 一起使用,但一直出现错误:
未捕获(承诺)类型错误:$(...).selectize 不是函数(...)
我有 jquery 正在通过 index.html 中的脚本标记加载,并试图在一个简单的组件中加载 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
:
关于selectize
:只需检查config.js
中的地图进行选择,我想你需要像import "selectize"
或import "selectize.js"