console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Draw Cursive Font</title>
<style>
</style>
</head>
<body>
<canvas id="myCanvas" width="120" height="40"></canvas>
<button onclick="convertToBase64()">将画布内容转换为Base64</button>
<script>
const canvas = document.getElementById('myCanvas');
const ctx = canvas.getContext('2d');
ctx.font = '30px cursive';
ctx.fillStyle = 'white';
ctx.fillText('云上筑', 0, 30);
function convertToBase64() {
const base64Data = canvas.toDataURL();
console.log(base64Data);
const imgElement = document.createElement('img');
imgElement.src = base64Data;
imgElement.style.display = 'none';
document.body.appendChild(imgElement);
}
</script>
</body>
</html>