fix: 新增右键和删除功能

This commit is contained in:
MTrun
2022-01-27 22:30:35 +08:00
parent f44d119f16
commit f57fa702d9
4 changed files with 91 additions and 4 deletions
@@ -52,7 +52,11 @@ export const useChartEditStoreStore = defineStore({
this.componentList.push(chartData)
},
// * 删除组件列表
removeComponentList<T extends { key: string }>(chartData: T): void {
removeComponentList<T extends { key: string }>(chartData: T | number): void {
if(typeof chartData === 'number') {
this.componentList.splice(chartData, 1)
return
}
const i = this.componentList.findIndex(e => e.key === chartData.key)
if (i !== -1) {
this.componentList.splice(i, 1)