select input component

This commit is contained in:
2018-09-17 10:18:53 +02:00
parent 20e87b30f3
commit 56773fdfad
14 changed files with 287 additions and 127 deletions

View File

@@ -0,0 +1,6 @@
<label for="{{name}}">{{label}}</label>
<select name="{{name}}">
{{#entries}}
<option value="{{value}}">{{text}}</option>
{{/entries}}
</select>

View File

@@ -0,0 +1,21 @@
import $ from 'jquery';
import Component from '../../../core/Component';
import markup from './Select.html';
export default class Select extends Component {
constructor(ctx, node, template) {
super(ctx, node, template || markup);
this.render(this.config);
}
onChange(evt) {
console.log(evt.target.value);
}
subscribe() {
this.node.delegate('select', 'change', this.onChange.bind(this));
}
}