feat: format subtitle
This commit is contained in:
@@ -21,7 +21,8 @@ export const loadingSvg = `
|
||||
export const createLogoSvg = ({
|
||||
width = "100%",
|
||||
height = "100%",
|
||||
viewBox = "-13 -14 60 60",
|
||||
viewBox = "-20 -20 70 70",
|
||||
isSelected = false,
|
||||
} = {}) => {
|
||||
const svgNS = "http://www.w3.org/2000/svg";
|
||||
const svgElement = document.createElementNS(svgNS, "svg");
|
||||
@@ -51,5 +52,14 @@ export const createLogoSvg = ({
|
||||
svgElement.appendChild(path1);
|
||||
svgElement.appendChild(path2);
|
||||
|
||||
if (isSelected) {
|
||||
const redLine = document.createElementNS(svgNS, "path");
|
||||
redLine.setAttribute("d", "M0 36 L32 36");
|
||||
redLine.setAttribute("stroke", "red");
|
||||
redLine.setAttribute("stroke-width", "3");
|
||||
redLine.setAttribute("stroke-linecap", "round");
|
||||
svgElement.appendChild(redLine);
|
||||
}
|
||||
|
||||
return svgElement;
|
||||
};
|
||||
|
||||
@@ -362,3 +362,15 @@ export const truncateWords = (str, maxLength) => {
|
||||
const truncated = str.slice(0, maxLength);
|
||||
return truncated.slice(0, truncated.lastIndexOf(" ")) + " …";
|
||||
};
|
||||
|
||||
/**
|
||||
* 生成随机数
|
||||
* @param {*} min
|
||||
* @param {*} max
|
||||
* @param {*} integer
|
||||
* @returns
|
||||
*/
|
||||
export const randomBetween = (min, max, integer = true) => {
|
||||
const value = Math.random() * (max - min) + min;
|
||||
return integer ? Math.floor(value) : value;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user