汪汪一只猫
您需要使用 listManageActions ui hook。这就是你如何做到这一点// ./admin-ui/index.js // this file is automatically imported into admin-ui for hooksimport { UpdateItems, DeleteItems, useList } '@keystonejs/admin-ui/components'import { useQuery, useMutation, useApolloClient } '@apollo/react-hooks'const ExportCsvButton = () => { const { list, selectedItems } = useList(); // your logic and react state hooks etc // selectedItems contains array of item Ids which are selected, list is the list you are in. const exportCsv = () => { // your logic to retrieve the items and data for exporting or doing custom work // you can use graphql to get } return (<Button onClick={() => exportCSV()}> Export CSV </Button>}export default { // re-implement the default delete many and update many items buttons + custom Button listManageActions: () => (<div><UpdateItems /><DeleteItems /><ExportCsvButton /></div>),};