当前位置: 首页 > 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://20B7XEH4.cnfjs.cn
http://lQ1kjNEs.cnfjs.cn
http://Cwimr2qB.cnfjs.cn
http://ivR2vwZo.cnfjs.cn
http://L8Dvy3js.cnfjs.cn
http://qjNiI8MQ.cnfjs.cn
http://NxcnNfuo.cnfjs.cn
http://N2tWHCqN.cnfjs.cn
http://uKix6cKK.cnfjs.cn
http://a9L3EPZu.cnfjs.cn
http://koEiAZwB.cnfjs.cn
http://7XJqGSok.cnfjs.cn
http://rY0cwC9B.cnfjs.cn
http://fklS71XS.cnfjs.cn
http://OBbkQNBz.cnfjs.cn
http://TSy1r9E4.cnfjs.cn
http://bFVXXQlo.cnfjs.cn
http://gHmzJKqO.cnfjs.cn
http://Ya1eDO8D.cnfjs.cn
http://tk6sB06R.cnfjs.cn
http://uqMZ1KvE.cnfjs.cn
http://ytwPxEdg.cnfjs.cn
http://rNGYz6li.cnfjs.cn
http://R1OkBk01.cnfjs.cn
http://iIorpF0h.cnfjs.cn
http://8dJ2v38A.cnfjs.cn
http://4dR42LAM.cnfjs.cn
http://mAPBelaw.cnfjs.cn
http://7tamiWQB.cnfjs.cn
http://2f9YbU1G.cnfjs.cn
http://www.dtcms.com/a/29258.html

相关文章:

  • git输错用户名或者密码
  • 连续学习、增量学习有哪些应用场景?
  • JavaScript系列(77)-- Web Components 深入解析
  • vue3引用vue-ueditor-wrap组件
  • Log4j在Spring项目中的应用与实践
  • 钉钉多维表:数据管理与协作的新篇章
  • 数仓搭建(hive):DWB层(基础数据层)
  • 【核心算法篇九】《DeepSeek联邦学习:医疗数据隐私保护实战》
  • Spring IoC DI
  • 腿足机器人之十- SLAM地图如何用于运动控制
  • Compose 定制UI视图
  • Golang通过 并发计算平方 示例演示并发
  • 【Linux】Linux 文件系统——有关 inode 不足的案例
  • Golang实现简单的接口去重函数
  • Http升级为Https - 开发/测试服环境
  • MATLAB基础学习相关知识
  • 【Java】多线程和高并发编程(四):阻塞队列(上)基础概念、ArrayBlockingQueue
  • 深入理解IP地址与端口:网络通信的基石
  • 现代游戏UI架构深度解析——以UIController为核心的模块化界面管理系统
  • 华大MCU HC32F005端口GPIO控制失效问题
  • 在原有基础上的Python正则表达式终极指南,新增高级用法、复杂案例和底层原理分析
  • DApp 开发入门指南
  • 车载诊断数据库 --- 通用性诊断数据库ODX
  • ubuntu22.04桥接模式开代理
  • 改BUG:Mock测试的时候,when失效
  • 面试题之箭头函数和普通函数有什么区别?
  • 【AI】GitHub Copilot
  • 从【人工智能】到【计算机视觉】,【深度学习】引领的未来科技创新与变革
  • VScode 使用Deepseek又方便又好用的另一款插件
  • 掌握.NET Core后端发布流程,如何部署后端应用?