84 lines
1.5 KiB
Vue
84 lines
1.5 KiB
Vue
<template>
|
|
<view class="dimension-panel">
|
|
<!-- 维度切换 -->
|
|
<picker :range="dimensionOptions" range-key="label" @change="onSwitch">
|
|
<view class="dimension-switch">切换维度</view>
|
|
</picker>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: 'DimensionPanel',
|
|
props: {
|
|
dimensionOptions: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
defaultColors: {
|
|
type: Array,
|
|
default: () => [
|
|
'#409EFF', '#67C23A', '#E6A23C', '#F56C6C', '#909399',
|
|
'#1abc9c', '#9b59b6', '#e67e22', '#e74c3c', '#34495e'
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
onSwitch(e) {
|
|
const dim = this.dimensionOptions[e.detail.value]
|
|
this.$emit('switch', dim)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.dimension-panel {
|
|
width: 100vw;
|
|
background: #fafbfc;
|
|
border-right: 1px solid #eee;
|
|
padding: 12px 0 8px 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
}
|
|
.discrete-bar {
|
|
width: 100%;
|
|
display: flex;
|
|
height: 10px;
|
|
margin-bottom: 10px;
|
|
border-radius: 5px;
|
|
overflow: hidden;
|
|
}
|
|
.bar-segment {
|
|
flex: 1;
|
|
height: 100%;
|
|
}
|
|
.dimension-legend {
|
|
display: flex;
|
|
flex-direction: row;
|
|
flex-wrap: wrap;
|
|
margin-bottom: 8px;
|
|
}
|
|
.legend-item {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-right: 16px;
|
|
margin-bottom: 6px;
|
|
}
|
|
.legend-color {
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 4px;
|
|
margin-right: 6px;
|
|
border: 1px solid #ccc;
|
|
}
|
|
.legend-label {
|
|
font-size: 13px;
|
|
color: #333;
|
|
}
|
|
.dimension-switch {
|
|
margin-top: 12px;
|
|
color: #409EFF;
|
|
text-align: center;
|
|
font-size: 13px;
|
|
}
|
|
</style> |