1234567891011121314151617181920212223242526272829303132 |
- <template>
- <canvas id="drawLine1" width="800" height="100" />
- </template>
- <script lang="ts">
- import { SCanvasView, SColor, SPainter } from "@saga-web/draw/lib";
- class TestView extends SCanvasView {
- constructor() {
- super("drawLine1")
- }
- onDraw(canvas: SPainter): void {
- // 在此编写绘制操作相关命令
- canvas.drawLine(0,0, 100, 100);
- canvas.pen.lineWidth = 1;
- canvas.pen.dashOffset += 10;
- canvas.pen.lineDash = [25, 5, 10, 30];
- canvas.drawLine(200, 50, 400, 50);
- this.update();
- }
- }
- export default {
- mounted() {
- new TestView();
- }
- }
- </script>
|