fix: 颜色选择器 添加透明度的选择 以及topo图 背景默认透明

This commit is contained in:
zhangyu
2021-11-19 14:25:27 +08:00
parent 6a00be20f0
commit 415d6fadf6
4 changed files with 20 additions and 5 deletions

View File

@@ -808,7 +808,7 @@ export default {
// data = JSON.parse(localStorage.getItem('topoData'))
if (!res.data.topo || !data.pens) {
data = {
bkColor: '#FFFFFF',
bkColor: '#FFFFFF00',
gridSize: 10,
gridColor: '#ededed',
lineWidth: 1,
@@ -887,6 +887,9 @@ export default {
if (!data.bkImage) {
data.bkImage = undefined
}
if (data.bkColor === '#FFFFFF') {
data.bkColor = '#FFFFFF00'
}
resolve(data)
}, 100)
}

View File

@@ -21,7 +21,7 @@
<el-row v-if="!single" class="color-tab">
<div v-for="item in valueArr" :key="item.key" :class="[keyName==item.name?'color-active':'']" @click="colorTabChange(item)">{{item.name}}</div>
</el-row>
<sketch v-model="colors" :disableAlpha="true" @input="updateValue" :presetColors="presetColors"/>
<sketch v-model="colors" :disableAlpha="disableAlpha" @input="updateValue" :presetColors="presetColors"/>
</div>
</span>
</template>
@@ -67,6 +67,10 @@ export default {
'#7C2EA3', '#8F3BB8', '#B877D9'
]
}
},
disableAlpha: {
type: Boolean,
default: false
}
},
watch: {},
@@ -89,7 +93,12 @@ export default {
methods: {
updateValue (color) {
this.colors = color.hex
this.$emit('colorChange', color.hex, this.keyName)
if (!this.disableAlpha) {
this.colors = color.hex8
this.$emit('colorChange', color.hex8, this.keyName)
} else {
this.$emit('colorChange', color.hex, this.keyName)
}
},
changeColor () {
this.showColorPicker = !this.showColorPicker

View File

@@ -1709,7 +1709,7 @@ export default {
return ''
}
;
if (color.length <= 7) {
if (color.indexOf('#') === 0) {
return color
}
const rgb = color.split(',')

View File

@@ -805,7 +805,7 @@ export default {
// data = JSON.parse(localStorage.getItem('topoData'))
if (!res.data.topo || !data.pens) {
data = {
bkColor: '#FFFFFF',
bkColor: '#FFFFFF00',
gridSize: 10,
gridColor: '#ededed',
lineWidth: 1,
@@ -886,6 +886,9 @@ export default {
if (!data.bkImage) {
data.bkImage = undefined
}
if (data.bkColor === '#FFFFFF') {
data.bkColor = '#FFFFFF00'
}
Promise.all(promiseArr).then(res => {
res.forEach((response, index) => {
const item = data.pens[index]