mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
925 B
925 B
Fixed Header
Display large amounts of data in scrollable view.
<n-data-table
ref="table"
:columns="columns"
:data="data"
:pagination="pagination"
max-height="250px"
@select="onSelectedChange"
/>
const columns = [
{
title: "Name",
key: "name"
},
{
title: "Age",
key: "age"
},
{
title: "Address",
key: "address"
}
]
const data = []
for (let i = 0; i < 46; i++) {
data.push({
key: i,
name: `Edward King ${i}`,
age: 32,
address: `London, Park Lane no. ${i}`
})
}
export default {
data() {
return {
data: data,
columns,
selectedData: []
}
},
computed: {
pagination() {
return { limit: 10 }
}
},
methods: {
sendMail(rowData) {
this.$NMessage.info("send mail to " + rowData.name)
},
onSelectedChange(selectedData) {
this.selectedData = selectedData
}
}
}