Improve Typescript support for ActorAutoComplete component
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
5c11bef368
commit
56d33214f1
|
@ -59,29 +59,29 @@ export default class ActorAutoComplete extends Vue {
|
||||||
|
|
||||||
totalPages = 1;
|
totalPages = 1;
|
||||||
|
|
||||||
mounted() {
|
mounted(): void {
|
||||||
this.selected = this.defaultSelected;
|
this.selected = this.defaultSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
data() {
|
data(): Record<string, unknown> {
|
||||||
return {
|
return {
|
||||||
getAsyncData: debounce(this.doGetAsyncData, 500),
|
getAsyncData: debounce(this.doGetAsyncData, 500),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch("defaultSelected")
|
@Watch("defaultSelected")
|
||||||
updateDefaultSelected(defaultSelected: IPerson) {
|
updateDefaultSelected(defaultSelected: IPerson): void {
|
||||||
console.log("update defaultSelected", defaultSelected);
|
console.log("update defaultSelected", defaultSelected);
|
||||||
this.selected = defaultSelected;
|
this.selected = defaultSelected;
|
||||||
this.name = defaultSelected.preferredUsername;
|
this.name = defaultSelected.preferredUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelect(selected: IPerson) {
|
handleSelect(selected: IPerson): void {
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
this.$emit("change", selected);
|
this.$emit("change", selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
async doGetAsyncData(name: string) {
|
async doGetAsyncData(name: string): Promise<void> {
|
||||||
this.baseData = [];
|
this.baseData = [];
|
||||||
if (this.name !== name) {
|
if (this.name !== name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
Loading…
Reference in a new issue