Commit e8ee1423e742f89e52760d42aa8bca2c6f251a91
1 parent
f9d87766
optimize Table style
optimize Table style
Showing
2 changed files
with
8 additions
and
30 deletions
Show diff stats
src/styles/mixins/caret.less
test/routers/table.vue
| 1 | <template> | 1 | <template> |
| 2 | - <i-table border :content="self" :columns="columns7" :data="data6"></i-table> | 2 | + <i-table :columns="columns1" :data="data1"></i-table> |
| 3 | + <i-table size="small" :columns="columns1" :data="data1"></i-table> | ||
| 3 | </template> | 4 | </template> |
| 4 | <script> | 5 | <script> |
| 5 | export default { | 6 | export default { |
| 6 | data () { | 7 | data () { |
| 7 | return { | 8 | return { |
| 8 | - self: this, | ||
| 9 | - columns7: [ | 9 | + columns1: [ |
| 10 | { | 10 | { |
| 11 | title: '姓名', | 11 | title: '姓名', |
| 12 | - key: 'name', | ||
| 13 | - render (row, column, index) { | ||
| 14 | - return `<Icon type="person"></Icon> <strong>${row.name}</strong>`; | ||
| 15 | - } | 12 | + key: 'name' |
| 16 | }, | 13 | }, |
| 17 | { | 14 | { |
| 18 | title: '年龄', | 15 | title: '年龄', |
| 19 | - key: 'age' | 16 | + key: 'age', |
| 17 | + sortable: true | ||
| 20 | }, | 18 | }, |
| 21 | { | 19 | { |
| 22 | title: '地址', | 20 | title: '地址', |
| 23 | key: 'address' | 21 | key: 'address' |
| 24 | - }, | ||
| 25 | - { | ||
| 26 | - title: '操作', | ||
| 27 | - key: 'action', | ||
| 28 | - width: 150, | ||
| 29 | - align: 'center', | ||
| 30 | - render (row, column, index) { | ||
| 31 | - return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`; | ||
| 32 | - } | ||
| 33 | } | 22 | } |
| 34 | ], | 23 | ], |
| 35 | - data6: [ | 24 | + data1: [ |
| 36 | { | 25 | { |
| 37 | name: '王小明', | 26 | name: '王小明', |
| 38 | age: 18, | 27 | age: 18, |
| @@ -55,17 +44,6 @@ | @@ -55,17 +44,6 @@ | ||
| 55 | } | 44 | } |
| 56 | ] | 45 | ] |
| 57 | } | 46 | } |
| 58 | - }, | ||
| 59 | - methods: { | ||
| 60 | - show (index) { | ||
| 61 | - this.$Modal.info({ | ||
| 62 | - title: '用户信息', | ||
| 63 | - content: `姓名:${this.data6[index].name}<br>年龄:${this.data6[index].age}<br>地址:${this.data6[index].address}` | ||
| 64 | - }) | ||
| 65 | - }, | ||
| 66 | - remove (index) { | ||
| 67 | - this.data6.splice(index, 1); | ||
| 68 | - } | ||
| 69 | } | 47 | } |
| 70 | } | 48 | } |
| 71 | </script> | 49 | </script> |