123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <div>
- <com-table
- :loading="loading"
- :columns="columns"
- :data-source="data"
- >
- <template #name="{text}">
- <a>{{ text }}</a>
- </template>
- </com-table>
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, ref } from 'vue'
- import ComTable from '_c/Table'
- const columns = [
- {
- title: 'Name',
- dataIndex: 'name',
- key: 'name',
- slots: { customRender: 'name' }
- },
- {
- title: 'Age',
- dataIndex: 'age',
- key: 'age',
- width: 80
- },
- {
- title: 'Address',
- dataIndex: 'address',
- key: 'address 1',
- ellipsis: true
- },
- {
- title: 'Long Column Long Column Long Column',
- dataIndex: 'address',
- key: 'address 2',
- ellipsis: true
- },
- {
- title: 'Long Column Long Column',
- dataIndex: 'address',
- key: 'address 3',
- ellipsis: true
- },
- {
- title: 'Long Column',
- dataIndex: 'address',
- key: 'address 4',
- ellipsis: true
- }
- ]
- const data = [
- {
- key: '1',
- name: 'John Brown',
- age: 32,
- address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
- tags: ['nice', 'developer']
- },
- {
- key: '2',
- name: 'Jim Green',
- age: 42,
- address: 'London No. 2 Lake Park, London No. 2 Lake Park',
- tags: ['loser']
- },
- {
- key: '3',
- name: 'Joe Black',
- age: 32,
- address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
- tags: ['cool', 'teacher']
- }
- ]
- export default defineComponent({
- // name: 'TableEllipsis',
- components: {
- ComTable
- },
- setup() {
- const loading = ref<boolean>(true)
- setTimeout(() => {
- loading.value = false
- }, 1000)
- return {
- loading,
- columns,
- data
- }
- }
- })
- </script>
- <style>
- </style>
|