材质UI小吃栏+进度

时间:2020-06-18 07:55:41

标签: reactjs material-ui

我正在使用Material UI(反应式)Snackbar notistack。 我想在Snackbar中使用Material UI Progress。例如:

Progress

在此里面: enter image description here

我正在使用动作道具,但不起作用:

const action  =(key)=>{
        return(
            <Box>
                <CircularProgressWithLabel value={uploadPercentage}/>
            </Box>
        )
    }

enqueueSnackbar('MY TEXT', { variant: 'info',persist: true,action  });

结果(仅显示0%): result

但我确定 uploadPercentage 已更改... 例如 console.log(uploadPercentage)

enter image description here

1 个答案:

答案 0 :(得分:0)

您的console.log是62%(例如), CircularProgressWithLabel value接受数字,而62%不是数字!

您正在这样做:

<CircularProgressWithLabel value={'62%'} />

正确的方法:

<CircularProgressWithLabel value={62} />