Ant Design Vue中Table对齐方式显示省略号

Ant Design Vue中Table对齐方式显示省略号

<template>
    <!-- bordered 表示表格中的边框
     pagination="false"不要分页 
	-->
	 
    <a-table :data-source="dataSource" :columns="columns" :pagination="false">
        <template #operation="{ record }">
            <a class="">编辑</a>
            <a class="line-linela"></a>
            <a-popconfirm
                v-if="dataSource.length"
                title="Sure to delete?"
                @confirm="onDelete(record.key)"
            >
                <a>删除</a>
            </a-popconfirm>
        </template>
    </a-table>
</template>
<script lang="ts">
import { defineComponent,Ref,ref } from 'vue'

interface DataItem {
    key: string
    fileNmae: string
    age: string
    address: string
}

export default defineComponent({
    setup() {
        // 字段(也就是表头)
        const columns = [
            {
                title: '编号',//字段名称
                dataIndex: 'fileNmae',width: '30%',},{
                title: '名称',dataIndex: 'fileNmae',{
                title: '备注',dataIndex: 'address',ellipsis: true,//超出显示省略好
            },{
                title: '操作',dataIndex: 'operation',slots: { customRender: 'operation' },align: 'right',//左对齐
            },]
        // 表中的数据
        const dataSource: Ref<DataItem[]> = ref([
            {
                key: '0',fileNmae: 'ML2340124',age: '耳机目录',address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',{
                key: '1',fileNmae: 'Edward King 1',address: 'London,Park Lane no. 1',])

        const onDelete = (key: string) => {
            console.log('==>',dataSource)
            dataSource.value = dataSource.value.filter(item => item.key !== key)
        }

        return {
            columns,onDelete,dataSource,}
    },})
</script>
<style lang="less">
.line-linela {
    width: 1px;
    height: 13px;
    display: inline-block;
    background: #f0f0f0 !important;
    margin-left: 8px;
    margin-right: 9px;
}
</style>

相关文章

过滤器:就是筛选filters: [ { text: '全部', v...
好处: 就是可以实现 响应式 拉伸行(row) 列(col)col要直接在...
创好vue 项目npm 下载antnpm i --save ant-design-vue@next完...
外面套个from 标签就好了。
antDesign表单函数配置分析用getFieldDecorator包起来的高阶...
之前在vue页面中引入axios使用,本篇在mainjs中引入1、mainj...