import { tableDataEdit } from "../data"; import { message } from "@/utils/message"; import { ref, computed, Transition } from "vue"; import { clone, delay } from "@pureadmin/utils"; import EditPen from "@iconify-icons/ep/edit-pen"; import Check from "@iconify-icons/ep/check"; // 温馨提示:修改整行方法雷同,将cellRenderer后面渲染的组件抽出来做对应处理即可 export function useColumns() { // 修改值(可多个) const inputValMap = ref({}); // 是否正处于修改状态(可多个) const editStatus = ref({}); // 当前激活的单元格(唯一) const activeIndex = ref(-1); const dataList = ref(clone(tableDataEdit, true)); const comVal = computed(() => { return index => { return inputValMap.value[index]?.value; }; }); const editing = computed(() => { return index => { return editStatus.value[index]?.editing; }; }); const iconClass = computed(() => { return (index, other = false) => { return [ "cursor-pointer", "ml-2", "transition", "delay-100", other ? ["hover:scale-110", "hover:text-red-500"] : editing.value(index) && ["scale-150", "text-red-500"] ]; }; }); const columns: TableColumnList = [ { label: "ID(可修改)", prop: "id", // class="flex-bc" flex-bc 代表 flex justify-between items-center 具体看 src/style/tailwind.css 文件 cellRenderer: ({ row, index }) => (
{row.id}