@lew
To create a tooltip with a blurred background in Vue.js, you can use a combination of CSS and Vue.js components. Here's a step-by-step guide on how to achieve this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<template> <div> <button @mouseenter="showTooltip = true" @mouseleave="showTooltip = false">Hover me</button> <div v-show="showTooltip" class="tooltip"> <div class="tooltip-content"> This is the tooltip content </div> </div> </div> </template> <script> export default { data() { return { showTooltip: false }; } }; </script> <style scoped> .tooltip { position: absolute; background-color: rgba(255, 255, 255, 0.8); border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); padding: 10px; filter: blur(5px); } .tooltip-content { color: black; } </style> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<template> <div> <Tooltip /> </div> </template> <script> import Tooltip from "./components/Tooltip.vue"; export default { components: { Tooltip } }; </script> |
1 2 3 4 5 6 7 8 |
.tooltip { position: absolute; background-color: rgba(255, 255, 255, 0.8); border-radius: 4px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); padding: 10px; filter: blur(5px); } |
That's it! You have successfully created a tooltip with a blurred background in Vue.js.