Created
February 7, 2022 10:19
-
-
Save jinnyMcKindy/6287f28867f7b412a74963783571b225 to your computer and use it in GitHub Desktop.
settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
export default class TableSettings extends Vue { | |
@Prop({ type: Array, default: () => [] }) headers!: TableHeader[]; | |
@VModel({ type: Array, default: () => [] }) | |
visibleHeaders!: TableHeader[]; | |
private visible: boolean = false; | |
protected internalHeaders: TableHeader[] = []; | |
@Watch("headers") | |
protected mounted(): void { | |
this.reset(); | |
this.apply(); | |
} | |
protected apply(): void { | |
this.visibleHeaders = this.internalHeaders.filter((h) => !h.hidden); | |
this.visible = false; | |
} | |
protected reset(): void { | |
this.internalHeaders = JSON.parse(JSON.stringify(this.headers)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment