naive-ui/demo/documentation/components/dataTable/enUS/ellipsis.md
2020-01-10 14:43:10 +08:00

1.1 KiB

Ellipsis

Ellipsize cell content via setting column.ellipsis.

<n-data-table
  ref='table'
  :columns='columns'
  :data='data'
  :pagination='pagination'
/>
const columns = [
  {
    title: 'Name',
    key: 'name'
  },
  {
    title: 'Age',
    key: 'age'
  },
  {
    title: 'Address',
    key: 'address',
    width: 100,
    ellipsis: true
  },
  {
    title: 'Another Address',
    key: 'anotherAddress',
    width: 100,
    ellipsis: true
  }
]

const data = [
  {
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    anotherAddress: 'New York No. 1 Lake Park'
  },
  {
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    anotherAddress: 'New York No. 1 Lake Park'
  },
  {
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    anotherAddress: 'New York No. 1 Lake Park'
  }
]

export default {
  data () {
    return {
      data,
      columns,
      pagination: { pageSize: 10 }
    }
  },
  methods: {
    sendMail(rowData) {
      this.$NMessage.info('Send mail to ' + rowData.name)
    }
  }
}