前端项目实战肆佰壹拾捌react-admin和material ui-路由重定向新增

const LineListActions = (props: any) => {
    return(
        <TopToolbar>
            <CreateButton
                to = {`/product/styleCreate/${props.category_id}`}
            />
        </TopToolbar>
    )
}
 <List resource = 't_prod_style' exporter = {false} hasCreate
            filter = {{category_id: category_id}}
            actions = {<LineListActions category_id = {category_id}/>}
            empty = {<Empty/>}
        >
            <Datagrid
                bulkActionButtons = {<BulkDeleteButton mutationMode="pessimistic"/>}
                rowClick = {handleLineRowClick}
            >
                <TextField source = 'id'/>
                <TextField source = 'code' label="款式code" />
                <TextField source = 'style_name' label="款式名称" />
                <TextField source = 'category_id' reference="t_prod_category" 
label = '所属品类' />
            </Datagrid>
        </List>

运行结果

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