support click pie chart to change current selected item

This commit is contained in:
MaysWind
2021-02-08 00:19:58 +08:00
parent 8ab1ad1a63
commit 2dd2c417d8
+5 -1
View File
@@ -11,7 +11,8 @@
:stroke="item.color | defaultIconColor('var(--default-icon-color)')" :stroke="item.color | defaultIconColor('var(--default-icon-color)')"
:stroke-width="diameter" :stroke-width="diameter"
:stroke-dasharray="item | itemStrokeDash(circumference)" :stroke-dasharray="item | itemStrokeDash(circumference)"
:stroke-dashoffset="item | itemDashOffset(validItems, circumference, itemCommonDashOffset)"> :stroke-dashoffset="item | itemDashOffset(validItems, circumference, itemCommonDashOffset)"
@click="switchSelectedIndex(idx)">
</circle> </circle>
<circle class="pie-chart-text-background" <circle class="pie-chart-text-background"
@@ -194,6 +195,9 @@ export default {
} }
}, },
methods: { methods: {
switchSelectedIndex: function (index) {
this.selectedIndex = index;
},
switchSelectedItem: function (offset) { switchSelectedItem: function (offset) {
let newSelectedIndex = this.selectedIndex + offset; let newSelectedIndex = this.selectedIndex + offset;