mirror of
https://gitlab.com/wirelos/sprocket-ui.git
synced 2025-12-16 06:34:32 +01:00
some changes
This commit is contained in:
3
src/app/components/base/Form/Form.html
Normal file
3
src/app/components/base/Form/Form.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<form action="{{endpoint}}">
|
||||
<button class="js-submit">Submit</button>
|
||||
</form>
|
||||
43
src/app/components/base/Form/Form.js
Normal file
43
src/app/components/base/Form/Form.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import $ from 'jquery';
|
||||
import Component from '../../../core/Component';
|
||||
import TextInput from '../TextInput/TextInput';
|
||||
import Store from '../../../core/store/RestStore';
|
||||
|
||||
export default class Form extends Component {
|
||||
|
||||
constructor(ctx, node) {
|
||||
super(ctx, node);
|
||||
this.store = new Store(this.config.endpoint);
|
||||
this.render(this.config);
|
||||
|
||||
this.fields = [];
|
||||
let tf1 = new TextInput(ctx);
|
||||
tf1.config = {
|
||||
name: 'ssid',
|
||||
label: 'SSID',
|
||||
placeholder: 'some AP'
|
||||
};
|
||||
tf1.value = 'MyAp';
|
||||
|
||||
this.fields.push(tf1);
|
||||
this.fields.forEach((f) => {
|
||||
f.render({
|
||||
name: 'ssid',
|
||||
label: 'SSID',
|
||||
placeholder: 'some AP'
|
||||
});
|
||||
this.node.prepend(f);
|
||||
});
|
||||
|
||||
this.node.delegate('click', '.js-submit', this.onSubmit.bind(this));
|
||||
}
|
||||
|
||||
onSubmit(evt) {
|
||||
let obj = {};
|
||||
|
||||
obj[this.config.name] = this.value;
|
||||
//this.store.save(obj);
|
||||
console.log(this.value);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user