mirror of
https://gitlab.com/wirelos/sprocket-ui.git
synced 2025-12-16 06:34:32 +01:00
select input component
This commit is contained in:
6
src/app/components/base/Select/Select.html
Normal file
6
src/app/components/base/Select/Select.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<label for="{{name}}">{{label}}</label>
|
||||
<select name="{{name}}">
|
||||
{{#entries}}
|
||||
<option value="{{value}}">{{text}}</option>
|
||||
{{/entries}}
|
||||
</select>
|
||||
21
src/app/components/base/Select/Select.js
Normal file
21
src/app/components/base/Select/Select.js
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user