avatar.js 399 Bytes
const avatarFn = {
  avatarCanvas: (name) => {
    let canvas = document.createElement('canvas')
    let con = canvas.getContext('2d')
    con.fillStyle = '#1890ff'
    con.fillRect(0, 0, 32, 32)
    con.fillStyle = '#ffffff'
    con.font = '18px Arial'
    con.textAlign = 'center'
    con.fillText(name, 50, 55)
    con.toDataURL()
    return canvas.toDataURL()
  }
}

export default { avatarFn }