1
キャッチされない(約束で)はTypeError:$(...)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/[email protected]/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/[email protected]/dist/jquery.min.js"></script>
.
.
.
私はこれがsystemjsロードで行うことがより多くを持っていることを感じているが、同じ結果とのindex.htmlにselectizeをロードしようとしています。誰かが私が間違っていることを指摘してくれますか? jqueryのを使用して2.2.1
おかげ
すべてのようにそれをインポートする必要があるとしています正しいと選択してロードするだけでjquery要素のプロトタイプを期待通りに拡張しない – weagle08
私の例は、jqueryとjqueryプラグインを使用するために推奨される方法で動作しています。スタンドアロン版ではなく、jspmパッケージの名前に応じてselectize.js ''または '' import "' selectize "を' 'import ''するときにロードされる'/dist/js/selectize.js' – valichek