mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
fix:1.节点图标不能删除的问题;2.工具按钮置灰仍然可以点击的问题
This commit is contained in:
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>一个简单的web思维导图实现</title><link href="dist/css/app.ab77c667.css" rel="preload" as="style"><link href="dist/css/chunk-vendors.6fd71983.css" rel="preload" as="style"><link href="dist/js/app.73d36c68.js" rel="preload" as="script"><link href="dist/js/chunk-vendors.384d822e.js" rel="preload" as="script"><link href="dist/css/chunk-vendors.6fd71983.css" rel="stylesheet"><link href="dist/css/app.ab77c667.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="dist/js/chunk-vendors.384d822e.js"></script><script src="dist/js/app.73d36c68.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>一个简单的web思维导图实现</title><link href="dist/css/app.b793e592.css" rel="preload" as="style"><link href="dist/css/chunk-vendors.6fd71983.css" rel="preload" as="style"><link href="dist/js/app.c4887e17.js" rel="preload" as="script"><link href="dist/js/chunk-vendors.384d822e.js" rel="preload" as="script"><link href="dist/css/chunk-vendors.6fd71983.css" rel="stylesheet"><link href="dist/css/app.b793e592.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="dist/js/chunk-vendors.384d822e.js"></script><script src="dist/js/app.c4887e17.js"></script></body></html>
|
||||
@@ -13,6 +13,9 @@
|
||||
v-for="icon in item.list"
|
||||
:key="icon.name"
|
||||
v-html="icon.icon"
|
||||
:class="{
|
||||
selected: iconList.includes(item.type + '_' + icon.name)
|
||||
}"
|
||||
@click="setIcon(item.type, icon.name)"
|
||||
></div>
|
||||
</div>
|
||||
@@ -34,7 +37,7 @@ export default {
|
||||
return {
|
||||
nodeIconList,
|
||||
dialogVisible: false,
|
||||
icon: [],
|
||||
iconList: [],
|
||||
activeNodes: [],
|
||||
};
|
||||
},
|
||||
@@ -43,10 +46,11 @@ export default {
|
||||
this.activeNodes = args[1];
|
||||
if (this.activeNodes.length > 0) {
|
||||
let firstNode = this.activeNodes[0];
|
||||
this.icon = firstNode.getData("icon") || [];
|
||||
this.iconList = firstNode.getData("icon") || [];
|
||||
} else {
|
||||
this.icon = [];
|
||||
this.iconList = [];
|
||||
}
|
||||
console.log(this.iconList, nodeIconList);
|
||||
});
|
||||
this.$bus.$on("showNodeIcon", () => {
|
||||
this.dialogVisible = true;
|
||||
@@ -59,16 +63,27 @@ export default {
|
||||
* @Desc: 设置icon
|
||||
*/
|
||||
setIcon(type, name) {
|
||||
let index = this.icon.findIndex((item) => {
|
||||
return item.split("_")[0] === type;
|
||||
let key = type + "_" + name;
|
||||
let index = this.iconList.findIndex((item) => {
|
||||
return item === key;
|
||||
});
|
||||
// 删除icon
|
||||
if (index !== -1) {
|
||||
this.icon.splice(index, 1, type + "_" + name);
|
||||
this.iconList.splice(index, 1);
|
||||
} else {
|
||||
this.icon.push(type + "_" + name);
|
||||
let typeIndex = this.iconList.findIndex((item) => {
|
||||
return item.split("_")[0] === type;
|
||||
});
|
||||
// 替换icon
|
||||
if (typeIndex !== -1) {
|
||||
this.iconList.splice(typeIndex, 1, key);
|
||||
} else {
|
||||
// 增加icon
|
||||
this.iconList.push(key);
|
||||
}
|
||||
}
|
||||
this.activeNodes.forEach((node) => {
|
||||
node.setIcon([...this.icon]);
|
||||
node.setIcon([...this.iconList]);
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -81,6 +96,10 @@ export default {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.deleteBtn {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
@@ -99,6 +118,20 @@ export default {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
&.selected {
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -4px;
|
||||
top: -4px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #409EFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,7 @@ export default {
|
||||
&.disabled {
|
||||
color: #bcbcbc;
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.icon {
|
||||
|
||||
Reference in New Issue
Block a user