parent
cc18bbe554
commit
d816435188
6 changed files with 456 additions and 4 deletions
@ -0,0 +1,44 @@ |
||||
<template> |
||||
<el-table :data="tableData" :default-sort="{prop:'date',order: 'descending'}" > |
||||
<el-table-column prop="date" label="Date" sortable></el-table-column> |
||||
<el-table-column prop="name" label="Name"></el-table-column> |
||||
<el-table-column prop="address" label="Address"></el-table-column> |
||||
</el-table> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "Table_Demo12", |
||||
data() { |
||||
return { |
||||
tableData: [ |
||||
{ |
||||
date: "2016-05-03", |
||||
name: "Tom", |
||||
address: "No. 189, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-04", |
||||
name: "Tom1", |
||||
address: "No. 1891, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-05", |
||||
name: "Tom2", |
||||
address: "No. 1892, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-06", |
||||
name: "Tom3", |
||||
address: "No. 1893, Grove St, Los Angeles" |
||||
}, |
||||
] |
||||
} |
||||
}, |
||||
} |
||||
</script> |
||||
|
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,62 @@ |
||||
<template> |
||||
<el-table :data="tableData"> |
||||
<el-table-column prop="date" label="Date"></el-table-column> |
||||
<el-table-column prop="name" label="Name" :filters="filters" :filter-method="filter_methods"></el-table-column> |
||||
<el-table-column prop="address" label="Address"></el-table-column> |
||||
</el-table> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "Table_Demo13", |
||||
data() { |
||||
return { |
||||
tableData: [ |
||||
{ |
||||
date: "2016-05-03", |
||||
name: "Tom", |
||||
address: "No. 189, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-04", |
||||
name: "Tom1", |
||||
address: "No. 1891, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-05", |
||||
name: "Tom2", |
||||
address: "No. 1892, Grove St, Los Angeles" |
||||
}, |
||||
{ |
||||
date: "2016-05-06", |
||||
name: "Tom3", |
||||
address: "No. 1893, Grove St, Los Angeles" |
||||
}, |
||||
], |
||||
filters: [ |
||||
{text: "Tom", value: "Tom"}, |
||||
{text: "Tom1", value: "Tom1"}, |
||||
{text: "Tom2", value: "Tom2"}, |
||||
{text: "Tom3", value: "Tom3"} |
||||
] |
||||
} |
||||
}, |
||||
methods: { |
||||
filter_methods(value, row, column) { |
||||
console.log('filter') |
||||
console.log(row) |
||||
console.log(column) |
||||
const property = column['property'] |
||||
console.log(property) |
||||
console.log(value) |
||||
console.log(row[property]) |
||||
return row[property] === value |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,257 @@ |
||||
<template> |
||||
<el-table :data="tableData"> |
||||
<el-table-column type="expand"> |
||||
<template #default="props"> |
||||
<div> |
||||
<p>State: {{ props.row.state}}</p> |
||||
<p>City: {{ props.row.city}}</p> |
||||
<p>Address: {{ props.row.address}}</p> |
||||
<p>Zip: {{ props.row.zip}}</p> |
||||
<h3>Family</h3> |
||||
<el-table :data="props.row.family"> |
||||
<el-table-column prop="name" label="Name"></el-table-column> |
||||
<el-table-column prop="state" label="State"></el-table-column> |
||||
<el-table-column prop="city" label="City"></el-table-column> |
||||
<el-table-column prop="address" label="Address"></el-table-column> |
||||
<el-table-column prop="zip" label="Zip"></el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="date" label="Date"></el-table-column> |
||||
<el-table-column prop="name" label="Name"></el-table-column> |
||||
</el-table> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "TableDemo14", |
||||
data() { |
||||
return { |
||||
tableData: [ |
||||
{ |
||||
date: '2016-05-03', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-02', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-04', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-01', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-08', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-06', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
date: '2016-05-07', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
family: [ |
||||
{ |
||||
name: 'Jerry', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Spike', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
{ |
||||
name: 'Tyke', |
||||
state: 'California', |
||||
city: 'San Francisco', |
||||
address: '3650 21st St, San Francisco', |
||||
zip: 'CA 94114', |
||||
}, |
||||
], |
||||
}, |
||||
] |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,62 @@ |
||||
<template> |
||||
<el-table :data="tableData" row-key="id" default-expand-all> |
||||
<el-table-column prop="date" label="Date"></el-table-column> |
||||
<el-table-column prop="name" label="Name"></el-table-column> |
||||
<el-table-column prop="address" label="Address"></el-table-column> |
||||
</el-table> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "Table_Demo15", |
||||
data() { |
||||
return { |
||||
tableData: [ |
||||
{ |
||||
id: 1, |
||||
date: '2016-05-02', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
}, |
||||
{ |
||||
id: 2, |
||||
date: '2016-05-04', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
}, |
||||
{ |
||||
id: 3, |
||||
date: '2016-05-01', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
children: [ |
||||
{ |
||||
id: 31, |
||||
date: '2016-05-01', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
}, |
||||
{ |
||||
id: 32, |
||||
date: '2016-05-01', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
id: 4, |
||||
date: '2016-05-03', |
||||
name: 'wangxiaohu', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
}, |
||||
] |
||||
} |
||||
} |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue