import { ref, computed } from "vue"; import { tableDataEdit } from "../data"; import EditPen from "@iconify-icons/ep/edit-pen"; import Check from "@iconify-icons/ep/check"; export function useColumns() { const editMap = ref({}); const activeIndex = ref(-1); const dataList = ref(tableDataEdit); const editing = computed(() => { return index => { return editMap.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: "姓名(可修改)", prop: "name", cellRenderer: ({ row, index }) => (
{row.name}
) : ( <>