/** * 首字母大写 * @param {string} str * @returns {string} */ export const capitalize = (str) => { return `${str.charAt(0).toUpperCase()}${str.slice(1)}`; } 扩展阅读 _.camelCase _.capitalize