diff --git a/package.json b/package.json index 0f89d82..e8adfd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aix-win-ws", - "version": "2.5.6", + "version": "2.5.7", "description": "", "main": "./out/main/index.js", "author": "上海交大重庆人工智能研究院", diff --git a/src/renderer/src/components/grid-pic/index.vue b/src/renderer/src/components/grid-pic/index.vue index 4769a98..9725af6 100644 --- a/src/renderer/src/components/grid-pic/index.vue +++ b/src/renderer/src/components/grid-pic/index.vue @@ -1,3 +1,16 @@ + - - - 添加 - - - 画笔 - - @@ -26,10 +44,18 @@ import {ref, computed, onMounted} from 'vue' import Draggable from 'vuedraggable' import ViewerItem from "./viewer-item.vue"; - import Fabric from 'fabric'; + // import Fabric from 'fabric'; const gridPicList = ref([]) const inputValue = ref('') const isShow = ref(false) + const emits = defineEmits(['clear','outIndex']); + + const props = defineProps({ + showToolbar: { + type: Boolean, + default: true + } + }) // 获取图片样式 const getWH = (item,index)=>{ return { @@ -118,13 +144,19 @@ } }) + const pushPic = () => { + let src = inputValue.value||picList[gridPicList.value.length] + addPic(src) + } // 添加图片 - const addPic = () => { + const addPic = (src) => { if (gridPicList.value.length >= 9) { + console.log("超出九个图片") + emits('outIndex') return } - let src = inputValue.value||picList[gridPicList.value.length] if (!src) { + console.log("图片链接不能为空") return; } gridPicList.value.push({ @@ -133,6 +165,11 @@ }) inputValue.value = '' } + // 清空图片 + const clearPic = () => { + gridPicList.value = [] + emits('clear') + } //开始画笔 const startPencil = () => { isShow.value = !isShow.value @@ -148,7 +185,7 @@ b = b.length === 1? '0' + b : b; return `#${r}${g}${b}`; } - //初始化画笔 + /* //初始化画笔 const initPend = () => { let canvas = new Fabric.fabric.Canvas('canvas_pic_001',{ interactive: false, @@ -162,10 +199,11 @@ canvas.freeDrawingBrush = new Fabric.fabric.PencilBrush(canvas) canvas.freeDrawingBrush.width = 1//设置画笔粗细 canvas.freeDrawingBrush.color = "red"//设置画笔颜色 - } - onMounted(() => { + }*/ + /*onMounted(() => { initPend() - }) + })*/ + defineExpose({addPic,clearPic})