perf: 优化项目面板

This commit is contained in:
kuaifan 2024-12-14 23:21:41 +08:00
parent 8cbae629a5
commit a1ce6e6928

View File

@ -527,6 +527,7 @@
</template> </template>
<script> <script>
import {debounce} from "lodash";
import Draggable from 'vuedraggable' import Draggable from 'vuedraggable'
import TaskPriority from "./TaskPriority"; import TaskPriority from "./TaskPriority";
import {mapGetters, mapState} from "vuex"; import {mapGetters, mapState} from "vuex";
@ -987,11 +988,20 @@ export default {
handler(val) { handler(val) {
if (val > 0) { if (val > 0) {
this.getFlowData(); this.getFlowData();
this.$nextTick(this.handleColumnScroll); this.handleColumnDebounce();
} }
}, },
immediate: true, immediate: true,
}, },
'allTask.length'() {
this.handleColumnDebounce();
},
'projectData.cacheParameter.completedTask'() {
this.handleColumnDebounce();
},
windowWidth() {
this.handleColumnDebounce();
}
}, },
methods: { methods: {
@ -1658,6 +1668,17 @@ export default {
return style; return style;
}, },
handleColumnDebounce() {
if (!this.columnDebounceInvoke) {
this.columnDebounceInvoke = debounce(_ => {
if (this.tabTypeActive === 'column') {
this.$nextTick(this.handleColumnScroll)
}
}, 10);
}
this.columnDebounceInvoke();
},
handleColumnScroll() { handleColumnScroll() {
this.columnList.forEach(({id}) => { this.columnList.forEach(({id}) => {
const ref = this.$refs[`column_${id}`]; const ref = this.$refs[`column_${id}`];