Commit 8adb96a3 authored by 吕超's avatar 吕超

feat:状态修改组件

parent b37f335d
<template>
<div class="statusControl" :style="statusStyle">
<ul>
<li
v-for="(item, index) in list"
:key="index"
:class="{ acitive: value === item.key }"
@click="onStatusChange(item.key)"
>
{{ item.value }}
</li>
</ul>
</div>
</template>
<script>
// #144683
export default {
name: "statusControl",
props: {
list: {
type: Array,
default: function () {
return [];
},
},
statusStyle: {
type: [Object, String],
default: "",
},
value: {
type: String,
default: "",
},
},
data() {
return {};
},
methods: {
onStatusChange(key) {
this.$emit("input", key);
},
},
};
</script>
<style scoped lang="less">
.statusControl {
ul li {
margin-bottom: 10px;
border-radius: 5px;
padding: 5px 10px;
width: 150px;
background-color: #fff;
box-shadow: 0 0 5px #fff9;
text-align: center;
cursor: pointer;
&.acitive {
color: #fff;
background-color: #144683;
}
}
}
</style>
...@@ -2,10 +2,16 @@ ...@@ -2,10 +2,16 @@
<!-- 农村沼气转型升级 --> <!-- 农村沼气转型升级 -->
<div class="methaneUpgrade"> <div class="methaneUpgrade">
<MethaneMap></MethaneMap> <MethaneMap></MethaneMap>
<StatusControl
:statusStyle="{ position: 'absolute', right: 0, top: '100px' }"
:list="statusControlList"
v-model="statusValue"
></StatusControl>
</div> </div>
</template> </template>
<script> <script>
import StatusControl from "@/components/statusControl/index.vue";
import MethaneMap from "./components/methaneMap"; import MethaneMap from "./components/methaneMap";
export default { export default {
name: "MethaneUpgrade", name: "MethaneUpgrade",
...@@ -14,10 +20,18 @@ export default { ...@@ -14,10 +20,18 @@ export default {
dateLevel: "year", dateLevel: "year",
curTime: "", curTime: "",
play: false, play: false,
statusControlList: [
{ key: "small", value: "小型沼气工程" },
{ key: "middle", value: "中型沼气工程" },
{ key: "big", value: "大型沼气工程" },
{ key: "ExtraLarge", value: "特大型沼气工程" },
],
statusValue: "small",
}; };
}, },
components: { components: {
MethaneMap, MethaneMap,
StatusControl,
}, },
methods: { methods: {
showDatePicker() { showDatePicker() {
...@@ -36,6 +50,7 @@ export default { ...@@ -36,6 +50,7 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
.methaneUpgrade { .methaneUpgrade {
position: relative;
height: 100vh; height: 100vh;
} }
</style> </style>
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