mirror of
https://github.com/szimek/sharedrop.git
synced 2026-06-16 21:10:54 +08:00
29 lines
630 B
JavaScript
29 lines
630 B
JavaScript
import Ember from "ember";
|
|
|
|
export default Ember.Component.extend({
|
|
content: null,
|
|
selectedValue: null,
|
|
|
|
didInitAttrs() {
|
|
this._super(...arguments);
|
|
var content = this.get("content");
|
|
|
|
if (!content) {
|
|
this.set("content", []);
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
change() {
|
|
const changeAction = this.get("action");
|
|
const selectedEl = this.$("select")[0];
|
|
const selectedIndex = selectedEl.selectedIndex;
|
|
const content = this.get("content");
|
|
const selectedValue = content[selectedIndex];
|
|
|
|
this.set("selectedValue", selectedValue);
|
|
changeAction(selectedValue);
|
|
}
|
|
}
|
|
});
|