javascript - 使用画布绘制不同形式的日期
问题描述
我想画一种不同形式的日期,像这样:
- 2019/01/07
- 2019.01.07
- 2019-01-07
- 2019/01/00٧
- 2019.01.00
- 2019-01-00号
- 2019 年 1 月 7 日(使用不同的语言)
代码:
function click() {
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
var carta = new Image();
carta.src = "national.jpg"
var t_milade = document.getElementById("t_milade").value;
carta.onload = function(){
context.drawImage(carta, 0, 0, 728, 546);
context.font = "900 35px Alfa Slab One";
context.fillStyle = "#181818";
context.textAlign = "right";
context.fillText(t_milade, 262, 440);
}
}
解决方案
推荐阅读
- firebase - v-on 处理程序中的错误:“auth 不是函数”-Vue js
- python - 用 X 替换列表中 3 的倍数
- python - 从 python 列表中选择添加到特定目标数的所有元素[不是两个和问题]
- python - fastapi.Response() 不返回自定义响应
- javascript - 编译为 javascript 时打字稿忽略行
- swift - 在带有 M1 芯片的 Xcode 12 范围内找不到类型“*”
- mongodb - 如果仅在 MongoDB 中满足特定条件,则进行分组
- reactjs - 类型错误:data.comments 未定义
- php - 从 Laravel 5.8 开始排序数组
- sql-server - MS SQL Server - 将列转换为行时未显示表中的所有数据