mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-25 10:50:27 +00:00
perf: 优化标签选择
This commit is contained in:
parent
b01a54437a
commit
5e4a08538b
@ -98,10 +98,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onOpen(tag = null) {
|
onOpen(tag = null) {
|
||||||
if (tag === null) {
|
this.editingTag = { ...this.getEmptyTag(), ...(tag || {}) }
|
||||||
tag = this.getEmptyTag()
|
|
||||||
}
|
|
||||||
this.editingTag = { ...tag }
|
|
||||||
this.showEditModal = true
|
this.showEditModal = true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<!-- Add Button -->
|
<!-- Add Button -->
|
||||||
<div class="footer-box">
|
<div class="footer-box">
|
||||||
<div class="add-button" @click="$emit('add')">
|
<div class="add-button" @click="$emit('add', searchQuery)">
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
<span>{{ $L('添加标签') }}</span>
|
<span>{{ $L('添加标签') }}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -99,6 +99,9 @@ export default {
|
|||||||
isSelected(tag) {
|
isSelected(tag) {
|
||||||
return this.value.some(item => item.name === tag.name);
|
return this.value.some(item => item.name === tag.name);
|
||||||
},
|
},
|
||||||
|
clearSearch() {
|
||||||
|
this.searchQuery = '';
|
||||||
|
},
|
||||||
toggleTag(tag) {
|
toggleTag(tag) {
|
||||||
const isSelected = this.isSelected(tag);
|
const isSelected = this.isSelected(tag);
|
||||||
let newValue;
|
let newValue;
|
||||||
@ -176,6 +179,8 @@ export default {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
|
margin: 0 -12px;
|
||||||
|
padding: 0 12px;
|
||||||
|
|
||||||
.tag-item {
|
.tag-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -155,6 +155,7 @@
|
|||||||
<div class="item-content tags">
|
<div class="item-content tags">
|
||||||
<EPopover v-model="tagShow" class="tags-select" placement="bottom">
|
<EPopover v-model="tagShow" class="tags-select" placement="bottom">
|
||||||
<TaskTagSelect
|
<TaskTagSelect
|
||||||
|
ref="tagSelect"
|
||||||
v-model="tagValue"
|
v-model="tagValue"
|
||||||
:data-sources="tagData"
|
:data-sources="tagData"
|
||||||
:loading="tagLoad > 0"
|
:loading="tagLoad > 0"
|
||||||
@ -2063,13 +2064,13 @@ export default {
|
|||||||
this.$set(this.delayTaskForm, 'type', type)
|
this.$set(this.delayTaskForm, 'type', type)
|
||||||
},
|
},
|
||||||
|
|
||||||
onTagAdd() {
|
onTagAdd(tagName) {
|
||||||
// 避免关闭选择框时触发更新
|
// 避免关闭选择框时触发更新
|
||||||
this.tagValue = this.getTag;
|
this.tagValue = this.getTag;
|
||||||
this.tagBakValue = $A.cloneJSON(this.tagValue);
|
this.tagBakValue = $A.cloneJSON(this.tagValue);
|
||||||
// 隐藏选择框并打开添加框
|
// 隐藏选择框并打开添加框
|
||||||
this.tagShow = false
|
this.tagShow = false
|
||||||
this.$refs.addTag.onOpen(null)
|
this.$refs.addTag.onOpen(tagName ? {name: tagName} : null)
|
||||||
},
|
},
|
||||||
|
|
||||||
onTagAddSave(result) {
|
onTagAddSave(result) {
|
||||||
@ -2082,6 +2083,7 @@ export default {
|
|||||||
];
|
];
|
||||||
// 触发更新
|
// 触发更新
|
||||||
this.updateData('tag', mergedTags);
|
this.updateData('tag', mergedTags);
|
||||||
|
this.$refs.tagSelect?.clearSearch();
|
||||||
},
|
},
|
||||||
|
|
||||||
getTypeLabel(type) {
|
getTypeLabel(type) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user