提交 34e65701 编写于 作者: shutao-dc's avatar shutao-dc

update view-draw.uvue

上级 c58f613c
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
}, },
methods: { methods: {
drawText() { drawText() {
let node = (this.$refs['draw-text-view'] as INode) let element = (this.$refs['draw-text-view'] as Element)
let ctx = node.getDrawableContext() let ctx = element.getDrawableContext()
let width = node.getBoundingClientRect().width let width = element.getBoundingClientRect().width
ctx!!.reset() ctx!!.reset()
ctx!!.font = "15px" ctx!!.font = "15px"
ctx!.textAlign = "center" ctx!.textAlign = "center"
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
ctx!!.update() ctx!!.update()
}, },
drawLines() { drawLines() {
let ctx = (this.$refs['draw-line-view'] as INode).getDrawableContext() let ctx = (this.$refs['draw-line-view'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.lineWidth = 10; ctx!!.lineWidth = 10;
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
y += 15; y += 15;
}, },
drawCircles() { drawCircles() {
let ctx = (this.$refs['draw-circle-view'] as INode).getDrawableContext() let ctx = (this.$refs['draw-circle-view'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
// Draw shapes // Draw shapes
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
}, },
drawStar() { drawStar() {
let ctx = (this.$refs['draw-dash-line'] as INode).getDrawableContext() let ctx = (this.$refs['draw-dash-line'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.beginPath(); ctx!!.beginPath();
var horn = 5; // 画5个角 var horn = 5; // 画5个角
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
return result return result
}, },
drawhouse() { drawhouse() {
let ctx = (this.$refs['draw-house'] as INode).getDrawableContext() let ctx = (this.$refs['draw-house'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.lineWidth = 10; ctx!!.lineWidth = 10;
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
ctx!!.update() ctx!!.update()
}, },
drawPoint() { drawPoint() {
let ctx = (this.$refs['draw-style'] as INode).getDrawableContext() let ctx = (this.$refs['draw-style'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
for (let j = 0; j < 6; j++) { for (let j = 0; j < 6; j++) {
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
ctx!!.update() ctx!!.update()
}, },
drawRect() { drawRect() {
let ctx = (this.$refs['draw-odd'] as INode).getDrawableContext() let ctx = (this.$refs['draw-odd'] as Element).getDrawableContext()
ctx!!.reset() ctx!!.reset()
// Create path // Create path
ctx!!.moveTo(30, 90); ctx!!.moveTo(30, 90);
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
}, },
drawArcTo() { drawArcTo() {
let ctx = (this.$refs['draw-arcto'] as INode).getDrawableContext() let ctx = (this.$refs['draw-arcto'] as Element).getDrawableContext()
ctx!.reset() ctx!.reset()
ctx!.beginPath(); ctx!.beginPath();
ctx!.moveTo(50, 20); ctx!.moveTo(50, 20);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册