@a2simcode/ui 0.0.286 → 0.0.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/simcode-ui.es.js +4170 -4160
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/table.md +1 -1
- package/docs/examples/table/add-row.vue +1 -6
- package/package.json +1 -1
package/docs/components/table.md
CHANGED
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
<table-add-row />
|
|
381
381
|
</template>
|
|
382
382
|
<template #description>
|
|
383
|
-
设置 `editConfig` 的 `isAddBtn` 为 `true` 开启添加按钮,可通过 `addBtnText` 自定义按钮文本。点击添加按钮会触发 `add` 事件,并自动在表格中插入一行新数据(使用列配置中的 `defaultValue
|
|
383
|
+
设置 `editConfig` 的 `isAddBtn` 为 `true` 开启添加按钮,可通过 `addBtnText` 自定义按钮文本。点击添加按钮会触发 `add` 事件,并自动在表格中插入一行新数据(使用列配置中的 `defaultValue`)。设置 `isRemoveBtn` 为 `true` 开启删除按钮,勾选行后删除,删除结果会通过 `v-model` 自动回写,无需在 `change` 事件中再手动移除数据。
|
|
384
384
|
</template>
|
|
385
385
|
</Demo>
|
|
386
386
|
|
|
@@ -75,13 +75,8 @@ const handleChange = (params: any) => {
|
|
|
75
75
|
if (params.type === 'add') {
|
|
76
76
|
// 新增行时,同步更新 records
|
|
77
77
|
records.value.push(params.value)
|
|
78
|
-
} else if (params.type === 'delete') {
|
|
79
|
-
// 删除行时,从 records 中移除对应的数据
|
|
80
|
-
const index = records.value.findIndex((item) => item.id === params.data.id)
|
|
81
|
-
if (index > -1) {
|
|
82
|
-
records.value.splice(index, 1)
|
|
83
|
-
}
|
|
84
78
|
}
|
|
79
|
+
// 删除行无需处理:组件已通过 v-model 回写删除后的数据,
|
|
85
80
|
}
|
|
86
81
|
|
|
87
82
|
const changeData = () => {
|