DrawPolyline1.vue 713 B

12345678910111213141516171819202122232425262728
  1. <template>
  2. <canvas height="100" id="drawPolyline1" width="800"/>
  3. </template>
  4. <script lang="ts">
  5. import { SCanvasView, SPainter, SPoint } from "@persagy-web/draw/lib";
  6. import { Component, Vue } from "vue-property-decorator";
  7. class TestView extends SCanvasView {
  8. arr: SPoint[] = [new SPoint(10, 10), new SPoint(10, 40), new SPoint(30, 30)];
  9. constructor() {
  10. super("drawPolyline1")
  11. }
  12. onDraw(canvas: SPainter): void {
  13. // 绘制折线
  14. canvas.drawPolyline(this.arr);
  15. }
  16. }
  17. @Component
  18. export default class DrawPolyline1 extends Vue {
  19. mounted(): void {
  20. new TestView();
  21. }
  22. }
  23. </script>