我使用的是react-wordcloud
包,每当容器的大小发生变化,它就会对单词云进行排序,以适应当前屏幕大小(70%)。
我的控制台受到警告的影响:
我尝试使用包的默认设置,但仍然收到此警告。
import ReactWordcloud from "react-wordcloud";
const options = {
colors: ["#FFF7E5", "#F9D3AB", "#f4cc72", "#ffbe2d", "#ffb100"],
enableTooltip: false,
deterministic: true,
fontFamily: "impact",
fontSizes: [40, 80],
fontStyle: "normal",
fontWeight: "normal",
padding: 2,
rotations: 1,
rotationAngles: [0],
scale: "sqrt",
spiral: "archimedean",
transitionDuration: 1000,
};
return(<div
style={{ width: "100%", height: "100%" }}
>
<ReactWordcloud options={options} words={props.wordCloud} />
</div>)
发布于 2022-10-14 22:29:01
你可以试试这个:
getContext('2d', { willReadFrequently: true });
有关更多信息,请参见:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
https://stackoverflow.com/questions/74020182
复制相似问题