Commit 3315454a authored by 范加坤's avatar 范加坤

图例

parent 169114c1
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="item"> <div class="item">
<div class="circle" :style="{ 'background-color': item }"></div> <div class="circle" :style="{ 'background-color': item }"></div>
<label> <label>
{{ showLabel(range[index - 1], range[index]) }} {{ showLabel(range, index) }}
</label> </label>
</div> </div>
</div> </div>
...@@ -23,35 +23,34 @@ ...@@ -23,35 +23,34 @@
<script> <script>
export default { export default {
data() { data() {
return {}; return {}
}, },
props: { props: {
title: { title: {
type: String, type: String
}, },
colors: { colors: {
type: Array, type: Array
}, },
range: { range: {
type: Array, type: Array
}, }
}, },
computed: { computed: {
showLabel() { showLabel() {
return function (min, max) { return function (range, index) {
if (max && min) { console.log(range, index)
return `${min} - ${max}`; if (index == 0) {
return `< ${range[0]}`
} else if (index === range.length) {
return `> ${range[index - 1]} `
} else {
return `${range[index - 1]} - ${range[index]}`
} }
if (max && !min) {
return `< ${max}`;
} }
if (!max && min) {
return `${min} <`;
} }
}; }
}, }
},
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment