mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-12-09 14:40:27 +08:00
perf: 优化演示页面
This commit is contained in:
@@ -56,7 +56,7 @@ export function useColumns() {
|
||||
];
|
||||
|
||||
const handleEdit = (index: number, row) => {
|
||||
message(`您编辑了第 ${index} 行,数据为:${JSON.stringify(row)}`, {
|
||||
message(`您修改了第 ${index} 行,数据为:${JSON.stringify(row)}`, {
|
||||
type: "success"
|
||||
});
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ export function useColumns() {
|
||||
);
|
||||
|
||||
const handleEdit = (index: number, row) => {
|
||||
message(`您编辑了第 ${index} 行,数据为:${JSON.stringify(row)}`, {
|
||||
message(`您修改了第 ${index} 行,数据为:${JSON.stringify(row)}`, {
|
||||
type: "success"
|
||||
});
|
||||
};
|
||||
|
||||
@@ -30,11 +30,11 @@ export function useColumns() {
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
label: "编辑",
|
||||
label: "修改",
|
||||
tips: "Edit",
|
||||
fn: row =>
|
||||
message(
|
||||
`您编辑了第 ${
|
||||
`您修改了第 ${
|
||||
dataList.value.findIndex(v => v.id === row.id) + 1
|
||||
} 行,数据为:${JSON.stringify(row)}`,
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@ import { clone, delay } from "@pureadmin/utils";
|
||||
import EditPen from "@iconify-icons/ep/edit-pen";
|
||||
import Check from "@iconify-icons/ep/check";
|
||||
|
||||
// 温馨提示:编辑整行方法雷同,将cellRenderer后面渲染的组件抽出来做对应处理即可
|
||||
// 温馨提示:修改整行方法雷同,将cellRenderer后面渲染的组件抽出来做对应处理即可
|
||||
export function useColumns() {
|
||||
// 编辑值(可多个)
|
||||
// 修改值(可多个)
|
||||
const inputValMap = ref({});
|
||||
// 是否正处于编辑状态(可多个)
|
||||
// 是否正处于修改状态(可多个)
|
||||
const editStatus = ref({});
|
||||
// 当前激活的单元格(唯一)
|
||||
const activeIndex = ref(-1);
|
||||
@@ -43,7 +43,7 @@ export function useColumns() {
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "ID(可编辑)",
|
||||
label: "ID(可修改)",
|
||||
prop: "id",
|
||||
// class="flex-bc" flex-bc 代表 flex justify-between items-center 具体看 src/style/tailwind.css 文件
|
||||
cellRenderer: ({ row, index }) => (
|
||||
@@ -93,7 +93,7 @@ export function useColumns() {
|
||||
inputValMap.value[index] = Object.assign({}, inputValMap.value[index], {
|
||||
value: id
|
||||
});
|
||||
// 处于编辑状态
|
||||
// 处于修改状态
|
||||
editStatus.value[index] = Object.assign({}, editStatus.value[index], {
|
||||
editing: true
|
||||
});
|
||||
@@ -112,14 +112,14 @@ export function useColumns() {
|
||||
function onSure(index) {
|
||||
dataList.value[index].id = inputValMap.value[index].value;
|
||||
message(
|
||||
`您编辑了第 ${index + 1} 行,编辑后数据为:${JSON.stringify(
|
||||
`您修改了第 ${index + 1} 行,修改后数据为:${JSON.stringify(
|
||||
dataList.value[index]
|
||||
)}`,
|
||||
{
|
||||
type: "success"
|
||||
}
|
||||
);
|
||||
// 编辑状态关闭
|
||||
// 修改状态关闭
|
||||
editStatus.value[index] = Object.assign({}, editStatus.value[index], {
|
||||
editing: false
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ export const list = [
|
||||
{
|
||||
key: "edit",
|
||||
content: rendContent("edit"),
|
||||
title: "单元格编辑",
|
||||
title: "单元格修改",
|
||||
component: Edit
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user