kpc icon indicating copy to clipboard operation
kpc copied to clipboard

Table添加表格列的配置描述columns属性

Open qinfeng0214 opened this issue 10 months ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 当我编写vue组件的时候,每遇到一个table组件,都需要通过TableColumn一个一个去编辑,当table有很多列的时候,后期维护也不是一件容易的事情。希望可以提供一个表格列的配置描述api Describe the solution you'd like A clear and concise description of what you want to happen. 这是我想要的实现方式:

<template>
  <Table :data="dataList" :columns="columns" />
</template>
<script setup>

import {ref} from 'vue '
import { Table } from '@king-design/vue'

const columns = [
      {
        title: '姓名',
        dataIndex: 'name',
        key: 'name',
      },
      {
        title: '年龄',
        dataIndex: 'age',
        key: 'age',
      }
]

const dataList = ref([
    {
    name:"tom",
    age:18
    },
    {
    name:"Jack",
    age:28
    }
])
 
</script>

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

qinfeng0214 avatar Apr 08 '24 09:04 qinfeng0214