Add tags switch in problem_list.

This commit is contained in:
zema1 2017-11-26 17:00:16 +08:00
parent b050291911
commit 28249159df

View File

@ -18,6 +18,12 @@
</Dropdown-menu>
</Dropdown>
</li>
<li>
<i-switch size="large" @on-change="handleTagsVisible">
<span slot="open">Tags</span>
<span slot="close">Tags</span>
</i-switch>
</li>
<li>
<Input v-model="query.keyword"
@on-enter="filterByKeyword"
@ -104,7 +110,7 @@
},
{
title: 'Title',
width: '40%',
width: '35%',
render: (h, params) => {
return h('Button', {
props: {
@ -145,19 +151,7 @@
render: (h, params) => {
return h('span', this.getACRate(params.row.accepted_number, params.row.submission_number))
}
},
{
title: 'Tags',
align: 'center',
render: (h, params) => {
let tags = []
params.row.tags.forEach(tag => {
tags.push(h('Tag', {}, tag))
})
return tags
}
}
],
problemList: [],
limit: 15,
@ -236,6 +230,29 @@
this.query.page = 1
this.pushRouter()
},
handleTagsVisible (value) {
if (value) {
this.problemTableColumns.push(
{
title: 'Tags',
align: 'center',
width: '200px',
render: (h, params) => {
let tags = []
params.row.tags.forEach(tag => {
tags.push(h('Tag', {}, tag))
})
return h('div', {
style: {
margin: '8px 0'
}
}, tags)
}
})
} else {
this.problemTableColumns.splice(this.problemTableColumns.length - 1, 1)
}
},
onReset () {
this.$router.push({name: 'problem-list'})
},