mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Demo:节点标签输入适配新颜色生成逻辑
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
v-for="(item, index) in tagArr"
|
||||
:key="index"
|
||||
:style="{
|
||||
backgroundColor: tagColorList[index].background,
|
||||
color: tagColorList[index].color
|
||||
backgroundColor: generateColorByContent(item)
|
||||
}"
|
||||
>
|
||||
{{ item }}
|
||||
@@ -40,7 +39,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tagColorList } from 'simple-mind-map/src/constants/constant'
|
||||
import { generateColorByContent } from 'simple-mind-map/src/utils/index'
|
||||
|
||||
/**
|
||||
* @Author: 王林
|
||||
@@ -52,7 +51,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tagColorList,
|
||||
tagArr: [],
|
||||
tag: '',
|
||||
activeNodes: [],
|
||||
@@ -68,6 +66,8 @@ export default {
|
||||
this.$bus.$off('showNodeTag', this.handleShowNodeTag)
|
||||
},
|
||||
methods: {
|
||||
generateColorByContent,
|
||||
|
||||
handleNodeActive(...args) {
|
||||
this.activeNodes = [...args[1]]
|
||||
if (this.activeNodes.length > 0) {
|
||||
@@ -140,6 +140,7 @@ export default {
|
||||
padding: 3px 5px;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 5px;
|
||||
color: #fff;
|
||||
|
||||
.delBtn {
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user