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