Skip to content

Instantly share code, notes, and snippets.

@jinnyMcKindy
Created February 7, 2022 10:19
Show Gist options
  • Save jinnyMcKindy/6287f28867f7b412a74963783571b225 to your computer and use it in GitHub Desktop.
Save jinnyMcKindy/6287f28867f7b412a74963783571b225 to your computer and use it in GitHub Desktop.
settings
@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