删除内存多余分配

2.1
咬轮猫 4 years ago
parent 2b24e7212f
commit b0a8ab2980

@ -1,8 +1,7 @@
<template> <template>
<div class="components-layout-left"> <div class="components-layout-left">
<a-input-search placeholder="搜索组件" <a-input-search placeholder="搜索组件" />
/>
<a-collapse v-model:activeKey="activeKey" <a-collapse v-model:activeKey="activeKey"
accordion> accordion>
<a-collapse-panel key="1" <a-collapse-panel key="1"
@ -31,7 +30,6 @@
</div> </div>
</template> </template>
<script> <script>
import global from '@/global/global.js';//
export default { export default {
props: ['svgInfoData'], props: ['svgInfoData'],
data () { data () {
@ -42,10 +40,12 @@ export default {
}, },
methods: { methods: {
Mousedown (type, title, color) { Mousedown (type, title, color) {
global.CurrentlySelectedToolBarType = type; window.CurrentlySelectedToolBar = {
global.CurrentlySelectedToolBarTypeName = title; Type: type,//svg
global.CurrentlySelectedToolBarTitle = title; TypeName:title,//svg
global.CurrentlySelectedToolBarColor = color; Title:title,//svg
Color:color//svg
};
}, },
} }
}; };

@ -1,10 +0,0 @@
//当前选中的左侧工具栏参数类型
let CurrentlySelectedToolBarType='';
//当前选中的左侧工具栏参数类型名称
let CurrentlySelectedToolBarTypeName='';
//当前选中的左侧工具栏参数标题
let CurrentlySelectedToolBarTitle='';
//当前选中的左侧工具栏参数颜色
let CurrentlySelectedToolBarColor='';
export default {
CurrentlySelectedToolBarType,CurrentlySelectedToolBarTypeName,CurrentlySelectedToolBarTitle,CurrentlySelectedToolBarColor}

@ -87,7 +87,6 @@
import LeftToolBar from '@/components/LeftToolBar.vue'; import LeftToolBar from '@/components/LeftToolBar.vue';
import RightToolBar from '@/components/RightToolBar.vue'; import RightToolBar from '@/components/RightToolBar.vue';
// import SvgComponents from '@/components/SvgComponents.vue'; // import SvgComponents from '@/components/SvgComponents.vue';
import global from '@/global/global.js';//
import SvgComponents from '@/components/SvgComponents.vue'; import SvgComponents from '@/components/SvgComponents.vue';
export default { export default {
components: { LeftToolBar, RightToolBar, SvgComponents }, components: { LeftToolBar, RightToolBar, SvgComponents },
@ -104,12 +103,6 @@ export default {
//线 //线
guideX: '', guideX: '',
guideY: '', guideY: '',
CurrentlySelectedToolBar: {
Type: '',//svg
TypeName: '',//svg
Title: '',//svg
Color: '',//svg
},
selectSvg: { selectSvg: {
ID: '',//svg ID: '',//svg
Index: 0, Index: 0,
@ -192,8 +185,8 @@ export default {
}, },
MousedownSvg (id, index, pointX, pointY, e) { MousedownSvg (id, index, pointX, pointY, e) {
this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType = ''; window.CurrentlySelectedToolBar.Type = '';
this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle = ''; window.CurrentlySelectedToolBar.Title = '';
//index //index
this.selectSvg.ID = id; this.selectSvg.ID = id;
this.selectSvg.Index = index; this.selectSvg.Index = index;
@ -209,7 +202,7 @@ export default {
MouseupCanvas () { MouseupCanvas () {
this.guideX.style.display = 'none'; this.guideX.style.display = 'none';
this.guideY.style.display = 'none'; this.guideY.style.display = 'none';
if (this.CurrentlySelectedToolBar.Title != '' || this.CurrentlySelectedToolBar.Type != '') { if (window.CurrentlySelectedToolBar.Title != '' || window.CurrentlySelectedToolBar.Type != '') {
return; return;
} }
// this.selectSvg.ID = ''; // this.selectSvg.ID = '';
@ -239,7 +232,6 @@ export default {
alert(JSON.stringify(this.svgLists)); alert(JSON.stringify(this.svgLists));
}, },
testE () { testE () {
this.svgLists = global.AnalogData;
}, },
testH () { testH () {
localStorage.setItem('svginfo', JSON.stringify(this.svgLists)); localStorage.setItem('svginfo', JSON.stringify(this.svgLists));
@ -291,24 +283,19 @@ export default {
_this.guideY = document.querySelector('#guide-y');//线y _this.guideY = document.querySelector('#guide-y');//线y
canvasdiv.addEventListener("dragover", function (e) { canvasdiv.addEventListener("dragover", function (e) {
e.preventDefault(); e.preventDefault();
_this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType;
_this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle;
_this.CurrentlySelectedToolBar.TypeName = global.CurrentlySelectedToolBarTypeName;
_this.CurrentlySelectedToolBar.Color = global.CurrentlySelectedToolBarColor;
_this.CurrentlySelectedToolBar.Height = global.CurrentlySelectedToolBarHeight;
}, false); }, false);
canvasdiv.addEventListener("drop", function (e) { canvasdiv.addEventListener("drop", function (e) {
e.preventDefault(); e.preventDefault();
if (_this.CurrentlySelectedToolBar.Type == '') { if (window.CurrentlySelectedToolBar.Type == '') {
return; return;
} }
// //
let svgItem = { let svgItem = {
id: _this.$UCore.GenUUid(), id: _this.$UCore.GenUUid(),
title: _this.CurrentlySelectedToolBar.Title, title: window.CurrentlySelectedToolBar.Title,
type: _this.CurrentlySelectedToolBar.Type, type: window.CurrentlySelectedToolBar.Type,
typeName: _this.CurrentlySelectedToolBar.TypeName, typeName: window.CurrentlySelectedToolBar.TypeName,
svgColor: _this.CurrentlySelectedToolBar.Color, svgColor: window.CurrentlySelectedToolBar.Color,
svgPositionX: e.offsetX, svgPositionX: e.offsetX,
svgPositionY: e.offsetY, svgPositionY: e.offsetY,
size: 1, size: 1,

Loading…
Cancel
Save