food/src/components/Tooltip.vue
tk 7ea8266f3c 【类 型】:style 1.改一下 “返航组件里面的tip标签组件” 位置 2.删掉几个无用组件
【原  因】:把组件全部放在组件目下面 不用子目录  以后有可能会用到 easycom 自动加载组件的特性 这样改目录结构符合规范
【过  程】:
【影  响】:
2024-08-06 16:10:50 +08:00

59 lines
1.1 KiB
Vue

<template>
<div class="tooltip-container no-select" :style="{ left: horizontalPosition }">
<div class="tooltip-content fb" :style="{ backgroundColor: backgroundColor }">
<div class="tooltip-arrow" :style="{ borderBottomColor: backgroundColor }"></div>
<slot></slot>
</div>
</div>
</template>
<script>
export default {
name: 'Tooltip',
props: {
horizontalPosition: {
type: String,
default: '50%' // 百分比,默认为 50%
},
backgroundColor: {
type: String,
default: '#333' // 默认背景颜色
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped>
.tooltip-container {
position: relative;
display: inline-block;
top: 20px;
}
.tooltip-content {
color: #fff;
padding: 5px 8px;
border-radius: 4px;
position: absolute;
white-space: nowrap;
transform: translate(-50%, -100%);
z-index: 1000;
}
.tooltip-arrow {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #333;
position: absolute;
top: -4px;
left: 50%;
transform: translateX(-50%);
}
</style>