闫增涛
2024-11-06 85da14ad4377e081a744934c3ded049808427f59
src/components/paint/index.vue
@@ -55,7 +55,7 @@
export default {
  data() {
    return {
      canvasWidth:400,
      canvasWidth:window.innerWidth > 450 ? 400 : window.innerWidth - 30,
      backgroundImgUrl: "", // 背景
      isDraw: true, // 绘画、框选模式
      brush: "Pencil", // 画笔类型
@@ -127,15 +127,9 @@
    },
  },
  mounted() {
    this.handleCanvasWidth()
    this.init();
  },
  methods: {
    handleCanvasWidth() {
      if(window.innerWidth < 450) {
        this.canvasWidth = window.innerWidth - 30
      }
    },
    // 初始化画布
    init() {
      this.canvas = new fabric.Canvas(