提交 964d8f3a 编写于 作者: H hdx

canvas: 增加变量类型

上级 85b3387d
...@@ -13,16 +13,14 @@ ...@@ -13,16 +13,14 @@
data() { data() {
return { return {
title: 'Canvas', title: 'Canvas',
drawing: null as any | null, drawing: null as UniElement | null,
canvasElement: null as any | null, canvasElement: null as HTMLCanvasElement | null,
canvasContext: null as any | null, canvasContext: null as CanvasRenderingContext2D | null,
} }
}, },
onReady() { onReady() {
this.drawing = this.$refs['drawing'] as any; this.drawing = this.$refs['drawing'] as UniElement;
// @ts-ignore this.canvasElement = document.createElement('canvas') as HTMLCanvasElement;
this.canvasElement = document.createElement('canvas')
// @ts-ignore
this.canvasElement.className = 'canvas' this.canvasElement.className = 'canvas'
this.drawing!.appendChild(this.canvasElement) this.drawing!.appendChild(this.canvasElement)
...@@ -33,7 +31,7 @@ ...@@ -33,7 +31,7 @@
</script> </script>
<style> <style>
.drawing >>> .canvas { .drawing>>>.canvas {
width: 300px; width: 300px;
height: 150px; height: 150px;
margin-left: auto; margin-left: auto;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册