前端项目实战叁佰柒拾react-admin和material ui-create查看页面跳转

  <Datagrid sx={{ width: '100%' }}
                bulkActionButtons={<BulkDeleteButton mutationMode='pessimistic' />}
                rowClick={handleRowClick}
            >
                <TextField source='id' />
                <TextField source='code' />
                <TextField source='category_name' />
                <ReferenceManyCount
                    label="style"
                    reference="t_prod_style"
                    target='category_id'
                    link
                />
                <ShowRecordButton />
            </Datagrid>
const ShowRecordButton = () => {
    const record = useRecordContext();
    return (
        <Button
            component={Link}
            to={`/product/categoryShow/${record.id}/show`}
            onClick={(e) => e.stopPropagation()}
            label='查看'
        >
            {<RemoveRedEye />}
        </Button>
    )
}

运行结果

 

posted @ 2023-09-03 20:19  前端导师歌谣  阅读(15)  评论(0)    收藏  举报  来源