2023-06-28 19:25:11 +08:00
|
|
|
<template>
|
|
|
|
<div class="spectra">
|
2023-06-29 17:43:15 +08:00
|
|
|
<div
|
2023-07-13 19:18:23 +08:00
|
|
|
:class="'spectra-item' + (item.value == innerValue ? ' active' : '')"
|
2023-06-29 17:43:15 +08:00
|
|
|
v-for="(item, index) in list"
|
|
|
|
:key="index"
|
|
|
|
@click="handleClick(item)"
|
|
|
|
>
|
|
|
|
{{ item.title }}
|
|
|
|
</div>
|
2023-06-28 19:25:11 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-06-29 17:43:15 +08:00
|
|
|
const list = [
|
|
|
|
{
|
2023-07-13 19:18:23 +08:00
|
|
|
title: 'Sample Data',
|
|
|
|
value: 'sample'
|
2023-06-29 17:43:15 +08:00
|
|
|
},
|
|
|
|
{
|
2023-07-13 19:18:23 +08:00
|
|
|
title: 'GasBg Data',
|
2023-07-20 14:11:37 +08:00
|
|
|
value: 'gasBg'
|
2023-06-29 17:43:15 +08:00
|
|
|
},
|
|
|
|
{
|
2023-07-13 19:18:23 +08:00
|
|
|
title: 'DetBg Data',
|
2023-07-20 14:11:37 +08:00
|
|
|
value: 'detBg'
|
2023-06-29 17:43:15 +08:00
|
|
|
},
|
|
|
|
{
|
2023-07-13 19:18:23 +08:00
|
|
|
title: 'QC Data',
|
|
|
|
value: 'qc'
|
2023-06-29 17:43:15 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
this.list = list
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleClick(item) {
|
2023-07-13 19:18:23 +08:00
|
|
|
this.innerValue = item.value
|
2023-06-29 17:43:15 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
innerValue: {
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', val)
|
|
|
|
},
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-06-28 19:25:11 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.spectra {
|
2023-06-29 17:43:15 +08:00
|
|
|
width: 159px;
|
|
|
|
max-height: 200px;
|
|
|
|
overflow: auto;
|
|
|
|
|
|
|
|
&-item {
|
|
|
|
padding: 4px 14px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
&.active {
|
|
|
|
background-color: #055565;
|
|
|
|
}
|
|
|
|
}
|
2023-06-28 19:25:11 +08:00
|
|
|
}
|
|
|
|
</style>
|