删除内存多余分配

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

@ -1,8 +1,7 @@
<template>
<div class="components-layout-left">
<a-input-search placeholder="搜索组件"
/>
<a-input-search placeholder="搜索组件" />
<a-collapse v-model:activeKey="activeKey"
accordion>
<a-collapse-panel key="1"
@ -31,7 +30,6 @@
</div>
</template>
<script>
import global from '@/global/global.js';//
export default {
props: ['svgInfoData'],
data () {
@ -42,10 +40,12 @@ export default {
},
methods: {
Mousedown (type, title, color) {
global.CurrentlySelectedToolBarType = type;
global.CurrentlySelectedToolBarTypeName = title;
global.CurrentlySelectedToolBarTitle = title;
global.CurrentlySelectedToolBarColor = color;
window.CurrentlySelectedToolBar = {
Type: type,//svg
TypeName:title,//svg
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 RightToolBar from '@/components/RightToolBar.vue';
// import SvgComponents from '@/components/SvgComponents.vue';
import global from '@/global/global.js';//
import SvgComponents from '@/components/SvgComponents.vue';
export default {
components: { LeftToolBar, RightToolBar, SvgComponents },
@ -104,12 +103,6 @@ export default {
//线
guideX: '',
guideY: '',
CurrentlySelectedToolBar: {
Type: '',//svg
TypeName: '',//svg
Title: '',//svg
Color: '',//svg
},
selectSvg: {
ID: '',//svg
Index: 0,
@ -192,8 +185,8 @@ export default {
},
MousedownSvg (id, index, pointX, pointY, e) {
this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType = '';
this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle = '';
window.CurrentlySelectedToolBar.Type = '';
window.CurrentlySelectedToolBar.Title = '';
//index
this.selectSvg.ID = id;
this.selectSvg.Index = index;
@ -209,7 +202,7 @@ export default {
MouseupCanvas () {
this.guideX.style.display = 'none';
this.guideY.style.display = 'none';
if (this.CurrentlySelectedToolBar.Title != '' || this.CurrentlySelectedToolBar.Type != '') {
if (window.CurrentlySelectedToolBar.Title != '' || window.CurrentlySelectedToolBar.Type != '') {
return;
}
// this.selectSvg.ID = '';
@ -239,7 +232,6 @@ export default {
alert(JSON.stringify(this.svgLists));
},
testE () {
this.svgLists = global.AnalogData;
},
testH () {
localStorage.setItem('svginfo', JSON.stringify(this.svgLists));
@ -291,24 +283,19 @@ export default {
_this.guideY = document.querySelector('#guide-y');//线y
canvasdiv.addEventListener("dragover", function (e) {
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);
canvasdiv.addEventListener("drop", function (e) {
e.preventDefault();
if (_this.CurrentlySelectedToolBar.Type == '') {
if (window.CurrentlySelectedToolBar.Type == '') {
return;
}
//
let svgItem = {
id: _this.$UCore.GenUUid(),
title: _this.CurrentlySelectedToolBar.Title,
type: _this.CurrentlySelectedToolBar.Type,
typeName: _this.CurrentlySelectedToolBar.TypeName,
svgColor: _this.CurrentlySelectedToolBar.Color,
title: window.CurrentlySelectedToolBar.Title,
type: window.CurrentlySelectedToolBar.Type,
typeName: window.CurrentlySelectedToolBar.TypeName,
svgColor: window.CurrentlySelectedToolBar.Color,
svgPositionX: e.offsetX,
svgPositionY: e.offsetY,
size: 1,

Loading…
Cancel
Save