当前位置: 首页 > news >正文

vue3 背景虚化,文字高亮效果

效果:

组件代码:

<template><div :style="styleComputed" class="background-blurring"><div class="mask"></div><div :style="styleComputed" class="blurring-text">background</div></div>
</template><script setup>
import { computed } from "vue";
const props = defineProps({url: String
});const styleComputed = computed(() => {return {backgroundImage: `url(${props.url})`};
});
</script><style scoped>
.background-blurring {background-repeat: no-repeat;width: 100%;height: 100%;font-size: 12vw;position: relative;
}
.background-blurring .blurring-text {width: 100%;height: 100%;-webkit-text-stroke: 2px #fff;display: flex;justify-content: center;align-items: center;position: absolute;left: 0;top: 0;background-clip: text;color: #0000;
}
.mask {width: 100%;height: 100%;background: rgba(0, 0, 0, 0.7);
}
</style>

使用代码:

<template>// 传入图片资源<BackgroundBlurring :url="img"/>
<template><script setup>
// 引入组件
import BackgroundBlurring from "./components/BackgroundBlurring.vue";
// 引入资源
import img from "@/assets/imgs/background.jpg";
</script>

http://www.lryc.cn/news/541942.html

相关文章:

  • 开源一个可以调RGB三色的小灯棒子
  • 在聚类算法的领域特定语言(DSL)中添加一个度量矩阵组件
  • 【C++】list 链表的使用+模拟实现
  • AI助力小微企业技术开发规范化管理 | 杂谈
  • Android 实现 RTMP 推流:快速集成指南
  • pipeline 使用git parameter插件实现动态选择分支构造
  • postcss.config.js 动态配置基准值
  • DeepSeek 冲击(含本地化部署实践)
  • eNSP下载安装(eNsp、WinPcap、Wireshark、VirtualBox下载安装)
  • 利用Ai对生成的测试用例进行用例评审
  • C#上位机--跳转语句
  • `sh` 与 `bash` 的区别详解
  • *PyCharm 安装教程
  • [特殊字符] Elasticsearch 双剑合璧:HTTP API 与 Java API 实战整合指南
  • 网络和操作系统基础篇
  • Oracle 连接报错:“ORA-12541:TNS:no listener ”,服务组件中找不到监听服务
  • 内外网文件传输 安全、可控、便捷的跨网数据传输方案
  • 基于Flask的租房信息可视化系统的设计与实现
  • 《Keras 2 :使用 RetinaNet 进行对象检测》:此文为AI自动翻译
  • 【Erdas实验教程】010:监督分类及后处理、精度评价
  • Moonshot AI 新突破:MoBA 为大语言模型长文本处理提效论文速读
  • 【Python量化金融实战】-第1章:Python量化金融概述:1.2 Python在量化金融中的优势与生态
  • react路由总结
  • edge浏览器将书签栏顶部显示
  • AIGC-Stable Diffusion模型介绍
  • 【算法】游艇租贷
  • 科普:Docker run的相关事项
  • Ryu:轻量开源,开启 SDN 新程
  • Python游戏编程之赛车游戏6-2
  • IDEA + 通义灵码AI程序员:快速构建DDD后端工程模板