Skip to content

Commit 4b4a770

Browse files
author
Guillaume Chau
committed
perf(ui): webpack analyzer optimization
1 parent 602be03 commit 4b4a770

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/@vue/cli-ui-addon-webpack/src/components/DonutModule.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
>
2929
<DonutModule
3030
v-for="module of module.children"
31+
v-if="isVisible(getRatio(module, ratio))"
3132
:key="module.id"
3233
:module="module"
3334
:depth="depth + 1"
@@ -96,7 +97,7 @@ export default {
9697
},
9798
9899
ratio () {
99-
return this.module.size[this.sizeField] / this.module.parent.size[this.sizeField] * this.parentRatio
100+
return this.getRatio(this.module, this.parentRatio)
100101
},
101102
102103
rotation () {
@@ -112,7 +113,7 @@ export default {
112113
},
113114
114115
visible () {
115-
return this.ratio > .002
116+
return this.isVisible(this.ratio)
116117
},
117118
118119
hover () {
@@ -124,7 +125,17 @@ export default {
124125
if (this.visible) {
125126
this.dasharray = this.$refs.path.getTotalLength()
126127
}
127-
}
128+
},
129+
130+
methods: {
131+
getRatio (module, parentRatio) {
132+
return module.size[this.sizeField] / module.parent.size[this.sizeField] * parentRatio
133+
},
134+
135+
isVisible (ratio) {
136+
return ratio > .0025
137+
}
138+
},
128139
}
129140
</script>
130141

0 commit comments

Comments
 (0)