UNPKG

eslink-ui-plus

Version:

vue3 component library, css framework

41 lines (35 loc) 1.06 kB
/* * @Author: xiaobo * @Description: * @Date: 2022-02-11 17:26:59 * @LastEditTime: 2022-02-14 14:00:50 * @FilePath: \eslink-ui-plus\components\page-table\hooks\useMainTable.ts */ import { useCounterStore } from "../../store/pageTable/counter"; export default function useMainTable() { const counterStore = useCounterStore(); // 行点击 let currentIndex = -1; const handleRowClick = (row: any,index:number) => { currentIndex = index if (counterStore.selectCount <= 1) { if(currentIndex >= 0) { counterStore.updateCounter(1) } else { counterStore.updateCounter(0) } } }; // checkbox选中 const handleCheckedChange = (checkedArr: Array<any>) => { counterStore.updateCounter(checkedArr.length) console.log(checkedArr.length,currentIndex); if(checkedArr.length <= 0 && currentIndex >= 0) { counterStore.updateCounter(1) } }; return { handleRowClick, handleCheckedChange } }