|
@@ -1,12 +1,17 @@
|
|
|
<!-- 电子围栏名称的一项 -->
|
|
<!-- 电子围栏名称的一项 -->
|
|
|
<template>
|
|
<template>
|
|
|
<div :class="props.active ? 'active' : ''" class="fenceItem">
|
|
<div :class="props.active ? 'active' : ''" class="fenceItem">
|
|
|
- <div>
|
|
|
|
|
|
|
+ <div class="fenceName">
|
|
|
{{ props.detail.name }}
|
|
{{ props.detail.name }}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<ElTag type="success" size="small" class="fenceLabel" v-if="props.detail.label">{{ props.detail.label }}</ElTag>
|
|
<ElTag type="success" size="small" class="fenceLabel" v-if="props.detail.label">{{ props.detail.label }}</ElTag>
|
|
|
- <el-popover placement="bottom" trigger="click" popper-style="min-width: 80px;width: 80px">
|
|
|
|
|
|
|
+ <el-popover
|
|
|
|
|
+ placement="bottom"
|
|
|
|
|
+ trigger="click"
|
|
|
|
|
+ popper-style="min-width: 80px;width: 80px"
|
|
|
|
|
+ v-model:visible="menuVisible"
|
|
|
|
|
+ >
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
<img :src="moreDotIcon" alt="菜单" class="moreDot" />
|
|
<img :src="moreDotIcon" alt="菜单" class="moreDot" />
|
|
|
</template>
|
|
</template>
|
|
@@ -21,6 +26,7 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { ElTag } from 'element-plus';
|
|
import { ElTag } from 'element-plus';
|
|
|
import moreDotIcon from '@/assets/icons/more-dot-icon.png';
|
|
import moreDotIcon from '@/assets/icons/more-dot-icon.png';
|
|
|
|
|
+ import { ref } from 'vue';
|
|
|
interface FenceDetail {
|
|
interface FenceDetail {
|
|
|
name: string;
|
|
name: string;
|
|
|
id: number;
|
|
id: number;
|
|
@@ -29,21 +35,23 @@
|
|
|
const props = defineProps<{ detail: FenceDetail; active: boolean }>();
|
|
const props = defineProps<{ detail: FenceDetail; active: boolean }>();
|
|
|
|
|
|
|
|
const emits = defineEmits<{ (e: 'edit', id: number): unknown; (e: 'delete', id: number): unknown }>();
|
|
const emits = defineEmits<{ (e: 'edit', id: number): unknown; (e: 'delete', id: number): unknown }>();
|
|
|
|
|
+ const menuVisible = ref(false);
|
|
|
|
|
+
|
|
|
|
|
+ const hideMenu = () => {
|
|
|
|
|
+ menuVisible.value = false;
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
const handleDelete = () => {
|
|
const handleDelete = () => {
|
|
|
|
|
+ hideMenu();
|
|
|
emits('delete', props.detail.id);
|
|
emits('delete', props.detail.id);
|
|
|
};
|
|
};
|
|
|
const handleEdit = () => {
|
|
const handleEdit = () => {
|
|
|
|
|
+ hideMenu();
|
|
|
emits('edit', props.detail.id);
|
|
emits('edit', props.detail.id);
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
<style>
|
|
|
- .fenceItem.active {
|
|
|
|
|
- background: #409eff;
|
|
|
|
|
- color: #fff;
|
|
|
|
|
- border-color: transparent;
|
|
|
|
|
- }
|
|
|
|
|
.moreDot {
|
|
.moreDot {
|
|
|
width: 20px;
|
|
width: 20px;
|
|
|
height: 20px;
|
|
height: 20px;
|
|
@@ -59,16 +67,34 @@
|
|
|
border: 1px solid #ccc;
|
|
border: 1px solid #ccc;
|
|
|
margin: 8px 0;
|
|
margin: 8px 0;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ background: #ededed;
|
|
|
|
|
+ }
|
|
|
|
|
+ &.active {
|
|
|
|
|
+ background: #409eff !important;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ border-color: transparent;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.popoverMenu {
|
|
.popoverMenu {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
- margin: 10px 0px;
|
|
|
|
|
|
|
+ /* margin: 10px 0px; */
|
|
|
|
|
+ padding: 5px 0px;
|
|
|
|
|
+ margin: 0 -12px;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ background: #ededed;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.fenceLabel {
|
|
.fenceLabel {
|
|
|
- position: absolute;
|
|
|
|
|
- bottom: 2px;
|
|
|
|
|
- right: 20px;
|
|
|
|
|
|
|
+ /* position: absolute; */
|
|
|
|
|
+ /* bottom: 2px;
|
|
|
|
|
+ right: 20px; */
|
|
|
height: 14px;
|
|
height: 14px;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .fenceName {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ display: inline-block;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|