coreui/coreui-vue

CSmartTable doesn't recognize typescript getter

kanemotos opened this issue · 1 comments

CSmartTable doesn't recognize typescript getter and the value is undefined.
Version 3 of CDataTable recognized it correctly.

  • macOS ver 12.6
  • Browser and version (Chrome 106.0.5249.119, Official Build, arm64)
  • Vue 3.2.41, coreui-pro 4.3.4
  • A reduced test case is below.
<template>
  <CCardBody>
    <CSmartTable bordered fixed responsive :items="items" :columns="columns"/>
  </CCardBody>
</template>

<script setup lang="ts">
const columns = [
  { key: "id", label: "ID" },
  { key: "first_name", label: "First Name" },
  { key: "last_name", label: "Last Name" },
  { key: "full_name", label: "Full Name" },
];

class Person {
  id!: number;
  first_name!: string;
  last_name!: string;

  public constructor(init?: Partial<Record<string, unknown>>) {
    Object.assign(this, init);
  }

  get full_name(): string {
    return `${this.first_name} ${this.last_name}`;
  }
}

const items = [
    new Person({ id: 1, first_name: "Nicolle", last_name: "Dale"}),
    new Person({ id: 2, first_name: "Abbie", last_name: "Moore"}),
    new Person({ id: 3, first_name: "Ella", last_name: "Bennett"}),
];
console.log(items[0].full_name); // => "Nicolle Dale"
</script>

スクリーンショット 2022-10-24 23 35 25

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions