From 56cdf07f8496685ba906ea75e7eb2faebb35371b Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 06 十一月 2024 17:04:11 +0800 Subject: [PATCH] 加入富文本编辑器 --- src/components/paint/index.vue | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/components/paint/index.vue b/src/components/paint/index.vue index eadb1e3..40386fc 100644 --- a/src/components/paint/index.vue +++ b/src/components/paint/index.vue @@ -1,6 +1,6 @@ <template> <div class="paint"> - <canvas id="canvas" width="400" :height="canvasHeight"></canvas> + <canvas id="canvas" :width="canvasWidth" :height="canvasHeight"></canvas> <!-- 鎿嶄綔鎸夐挳 --> <ul class="paint-btn"> <li class="paint-btn-box"> @@ -55,6 +55,7 @@ export default { data() { return { + canvasWidth:400, backgroundImgUrl: "", // 鑳屾櫙 isDraw: true, // 缁樼敾銆佹閫夋ā寮� brush: "Pencil", // 鐢荤瑪绫诲瀷 @@ -126,9 +127,15 @@ }, }, mounted() { + this.handleCanvasWidth() this.init(); }, methods: { + handleCanvasWidth() { + if(window.innerWidth < 450) { + this.canvasWidth = window.innerWidth - 30 + } + }, // 鍒濆鍖栫敾甯� init() { this.canvas = new fabric.Canvas( -- Gitblit v1.9.1