phone-table-column.vue 606 Bytes
<script setup lang="ts">
import { get } from "lodash";
import TableColumn from "@/components/filter/table-column.vue";

withDefaults(defineProps<{ title?: string; dataIndex: string; areaIndex?: string }>(), {
  areaIndex: "area_code"
});

const getValue = (record: object, path: string) => {
  return get(record, path, "");
};
</script>

<template>
  <TableColumn v-bind="$attrs" :title="title" :data-index="dataIndex">
    <template #default="{ record }"> {{ `(+${getValue(record, areaIndex)}) ${getValue(record, dataIndex)}` }}</template>
  </TableColumn>
</template>

<style scoped lang="less"></style>