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

nuxt3网站文章分享微信 ,QQ功能

1.安装
npm install qrcode --save-dev
2.组件使用

  <div class="share"><div style="line-height: 69px; color: #fff;width: 100px;"><p style="text-align: center;">分享:</p></div><div @click="shareToMicroblog()" class="BJ_WB"><a class="weibo" /><a>微博</a></div><!-- <div @click="shareToQQ()" class="BJ_QQ"><a class="qq"></a><a>QQ好友</a></div> --><divclass="BJ_WX"@mouseover="showQR = true"@mouseleave="showQR = false"><div class="weixinall"><a class="weixin" /><a>微信</a></div><divclass="weixincode":class="{ 'qrcode-visible': showQR }"style="position: absolute;top: -220px;opacity: 0;transition: opacity 0.3s ease;width: 200px;height: 200px;background-color: #fff;"><canvasid="QRCode_header"style="width: 165px; height: 165px; margin: auto"/><pstyle="color: #818181;font-size: 12px;line-height: 16px;margin-left: 15px;">打开微信扫一扫<br />将您喜欢的内容分享微信朋友圈</p></div></div><div class="BJ" @click="shareToQQRom()"><a class="qqkj"></a><a>QQ</a></div></div>
<script setup lang="ts">
import QRCode from "qrcode";
const route = useRoute();
const id = ref(route.params.id);
const showQR = ref(false);
const shareUrl = `https://XXXXXXX.COM/XXXXXXXXXX/${id.value}`;
//分享到QQ
// const shareToQQ= function() {
//   window.open(
//       `https://connect.qq.com/widget/shareqq/index.html?url=${shareUrl}&title=${sysInfo}&source=${shareUrl}&desc=${sysInfo}&pics=`)
// }
//分享到微信
onMounted(() => {const QR_OPTIONS = {errorCorrectionLevel: "H",width: 165,height: 165,margin: 3,color: {dark: "#000",light: "#fff",},};QRCode.toCanvas(document.querySelector("#QRCode_header"),shareUrl,QR_OPTIONS,(error: any) => {if (error) console.error("二维码生成失败:", error);});
});//分享到微博
const shareToMicroblog = function () {window.open(`https://service.weibo.com/share/share.php?url=${shareUrl}&title=${details.value.productBackground}`);
};//分享到qq空间
const shareToQQRom = function () {const pics = encodeURIComponent(details.value.productBackgroundImage);const desc = encodeURIComponent(details.value.productBackground);window.open(`https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=${shareUrl}&title=${details.value.productBackground}&summary=${details.value.productBackground}&desc=${desc}&pics=${pics}`);
};
</script>
<style scoped lang="scss">
.share {display: flex;flex-wrap: nowrap;width: 100%;justify-content: center;.weibo {display: block;width: 24px;height: 21px;background-image: url("/assets/img/wb.png") !important;background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;}.BJ_WB {background-color: #e6162d;width: 110px;height: 40px;margin-top: 15px;margin-right: 15px;display: flex;border-radius: 8px;justify-content: center;align-items: center;color: #fff;cursor: pointer;&:hover {background-color: #f75567;transform: translateY(-2px);}}.BJ_QQ {background-color: #2384cc;width: 110px;height: 40px;margin-top: 15px;margin-right: 15px;display: flex;border-radius: 8px;justify-content: center;align-items: center;color: #fff;cursor: pointer;&:hover {background-color: #5faae2;transform: translateY(-2px);}}.BJ_WX {background-color: #3cb034;width: 110px;height: 40px;margin-top: 15px;border-radius: 8px;/* position: relative; */display: flex;justify-content: center;align-items: center;transition: transform 0.2s;color: #fff;cursor: pointer;&:hover {background-color: #7dd377;transform: translateY(-2px);}}.BJ {background-color: rgb(255, 206, 0);width: 110px;height: 40px;display: flex;border-radius: 8px;justify-content: center;align-items: center;color: #fff;margin: 15px;cursor: pointer;&:hover {background-color: #ffde52;transform: translateY(-2px);}}.qq {display: block;width: 28px;height: 28px;background-image: url("/assets/img/qq.png");background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;}.qqkj {display: block;width: 28px;height: 28px;background-image: url("/assets/img/qqkj.png");background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;}.weixinall {position: relative;display: flex;justify-content: center;.weixin {display: block;width: 28px;height: 28px;background-image: url("/assets/img/wx.png");background-size: cover;background-repeat: no-repeat;background-position: 50% 50%;}.weixincode {position: absolute;left: -60px;z-index: 1000 !important;}}
}.qrcode-visible {opacity: 1 !important;pointer-events: auto;
}
</style>

效果
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

相关文章:

nuxt3网站文章分享微信 ,QQ功能

1.安装 npm install qrcode --save-dev 2.组件使用 <div class"share"><div style"line-height: 69px; color: #fff;width: 100px;"><p style"text-align: center;">分享:</p></div><div click"shareToMi…...

智能任务分配:Python高并发架构设计

Python并发编程实战&#xff1a;多进程与多线程的智能任务分配策略 引言&#xff1a;突破性能瓶颈的关键选择 在CPU核心数量激增和I/O密集型应用普及的今天&#xff0c;Python开发者面临着一个关键抉择&#xff1a;如何通过并发编程充分释放硬件潜力&#xff1f;本文通过实测数…...

Oracle 数据库通过exp/imp工具迁移指定数据表

项目需求&#xff1a;从prod数据库迁移和复制2个表(BANK_STATE&#xff0c;HBS)的数据到uat数据库环境。 数据库版本&#xff1a;Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 迁移工具&#xff1a;客户端exp/imp工具 -- 执行命令 从Prod数据库导出数据exp us…...

批发订货系统:驱动企业数字化转型的核心引擎

在数字经济时代&#xff0c;传统批发企业正面临供应链效率低、客户体验不足、管理成本高等挑战。而批发订货系统作为企业数字化转型的重要工具&#xff0c;正通过智能化、数据化和流程重构&#xff0c;重塑企业的运营模式&#xff0c;助力企业实现降本增效与业务创新。以下从多…...

STM32F103_LL库+寄存器学习笔记07 - 串口接收缓冲区非空中断

导言 上一章节《STM32F103_LL库寄存器学习笔记06 - 梳理串口与串行发送“Hello,World"》梳理完USART的基本设置与发送字符串“Hello,World"&#xff0c;接着梳理接收缓冲区非空中断。 实用的串口接收程序都会使用中断方式&#xff0c;不会使用轮询方式。最主要的原因…...

python将整个txt文件写入excel的一个单元格?

要将整个txt文件写入Excel的一个单元格&#xff0c;可以使用Python的openpyxl库来实现。以下是一个简单的示例代码&#xff1a; from openpyxl import Workbook# 读取txt文件内容 with open(file.txt, r) as file:txt_content file.read()# 创建一个新的Excel工作簿 wb Work…...

CentOS 8 Stream 配置在线yum源参考 —— 筑梦之路

CentOS 8 Stream ISO 文件下载地址&#xff1a;http://mirrors.aliyun.com/centos-vault/8-stream/isos/x86_64/CentOS-Stream-8-20240603.0-x86_64-dvd1.isoCentOS 8 Stream 网络引导ISO 文件下载地址&#xff1a;http://mirrors.aliyun.com/centos-vault/8-stream/isos/x86_6…...

生物中心论

Robert Lanza的“生物中心论”&#xff08;Biocentrism&#xff09;是一种以生命和意识为核心的宇宙观&#xff0c;试图颠覆传统科学对时间、空间和物质的理解。 一、核心观点 意识创造宇宙 生物中心论认为&#xff0c;宇宙的存在依赖于观察者的意识。传统科学将宇宙视为独立实…...

LeetCode //C - 650. 2 Keys Keyboard

650. 2 Keys Keyboard There is only one character ‘A’ on the screen of a notepad. You can perform one of two operations on this notepad for each step: Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).Paste:…...

【leetcode hot 100 347】前 K 个高频元素

解法一&#xff1a;用map的value记录key出现的次数&#xff0c;用PriorityQueue构造最小堆。 class Solution {public int[] topKFrequent(int[] nums, int k) {// 把元素放在map中Map<Integer,Integer> map new HashMap<>();for(int num:nums){if(map.containsK…...

Spring三级缓存解决循环依赖的深度解析

一、循环依赖场景 假设存在两个Bean的相互依赖&#xff1a; Component public class ServiceA {Autowiredprivate ServiceB serviceB; }Component public class ServiceB {Autowiredprivate ServiceA serviceA; }二、三级缓存定义 在 DefaultSingletonBeanRegistry 中定义&a…...

Spring AOP:面向切面编程的探索之旅

目录 1. AOP 2. Spring AOP 快速入门 2.1 引入 Spring AOP 依赖 2.2 Spring AOP 简单使用 3. Spring AOP 核心概念 3.1 切点 3.1.1 Pointcut 定义切点 3.1.2 切点表达式 3.1.2.1 execution 表达式 3.1.2.2 annotation 表达式 3.2 连接点 3.3 通知(Advice) 3.3.1 通…...

使用QT画带有透明效果的图

分辨率&#xff1a;24X24 最大圆 代码: #include <QApplication> #include <QImage> #include <QPainter>int main(int argc, char *argv[]) {QImage image(QSize(24,24),QImage::Format_ARGB32);image.fill(QColor(0,0,0,0));QPainter paint(&image);…...

RocketMQ可视化工具使用 - Dashboard(保姆级教程)

1、github拉取代码&#xff0c;地址&#xff1a; https://github.com/apache/rocketmq-dashboard 2、指定Program arguments&#xff0c;本地启动工程 勾上这个Program arguments&#xff0c;会出现多一个对应的框 写入参数 --server.port1280 --rocketmq.config.namesrvAddr…...

用Unity实现UDP客户端同步通信

制作UDPNetMgr网络管理模块 这段代码定义了一个名为UDPNetMgr的 Unity 脚本类&#xff0c;用于管理 UDP 网络通信&#xff0c;它作为单例存在&#xff0c;在Awake方法中创建收发消息的线程&#xff0c;Update方法处理接收到的消息&#xff1b;StartClient方法启动客户端连接&a…...

pandoc安装及基础使用

pandoc安装 访问pandoc tags,切换至想要安装的版本&#xff0c;本次安装3.6.4 下载windows版本 下载texlive镜像&#xff0c;将文件转换成pdf需要用到 点开后会进入最近的镜像网站 下载完成后解压iso文件&#xff0c;以管理员身份运行install-tl-windows.bat&#xff…...

C++:无序关联容器

遇到的问题&#xff0c;都有解决方案&#xff0c;希望我的博客能为您提供一点帮助。 一、无序关联容器概述 无序关联容器&#xff08;如 unordered_set、unordered_map、unordered_multiset、unordered_multimap&#xff09;基于 ​哈希表&#xff08;Hash Table&#xff09;​…...

3.27学习总结 算法题

自己用c语言做的&#xff0c;不尽如意 后面看了题解&#xff0c;用的是c&#xff0c;其中string 变量和字符串拼接感觉比c方便好多&#xff0c;可以用更少的代码实现更好的效果&#xff0c;打算之后去学习c&#xff0c;用c写算法。 递归&#xff0c;不断输入字符&#xff0c;…...

案例分享|树莓派媒体播放器,重构商场广告的“黄金三秒”

研究显示&#xff0c;与传统户外广告相比&#xff0c;数字户外广告在消费者心中的记忆率提高了17%&#xff0c;而动态户外广告更是能提升16%的销售业绩&#xff0c;整体广告效率提升了17%。这一显著优势&#xff0c;使得越来越多资源和技术流入数字广告行业。 户外裸眼3D广告 无…...

Redisson - 分布式锁和同步器

文章目录 锁&#xff08;Lock&#xff09;公平锁&#xff08;Fair Lock&#xff09;联锁&#xff08;MultiLock&#xff09;红锁&#xff08;RedLock&#xff09; 【已废弃】读写锁&#xff08;ReadWriteLock&#xff09;信号量&#xff08;Semaphore&#xff09;可过期许可信号…...

Zustand 状态管理:从入门到实践

Zustand 状态管理&#xff1a;从入门到实践 Zustand 是一个轻量、快速且灵活的 React 状态管理库。它基于 Hooks API&#xff0c;提供了简洁的接口来创建和使用状态&#xff0c;同时易于扩展和优化。本文将通过一个 TODO 应用实例带你快速入门 Zustand&#xff0c;并探讨其核心…...

[RITSEC CTF 2025] Crypto

这个忘打了&#xff0c;难度不小。 Alien Encryption 101 一个很小的RSA&#xff0c;略 Cuwves 2 Electric Boogaloo 已知p,在p^2下的两个椭圆曲线的j不变量&#xff0c;直接用函数 Mothership AES_CBC加密给出密文和IV&#xff0c;通过调整IV来修改明文 import base64 …...

算法250327题目

1114: 4006 AB问题 题目描述 给定两个整数A和B&#xff0c;其表示形式是&#xff1a;从个位开始&#xff0c;每三位数用逗号,隔开。 现在请计算AB的结果&#xff0c;并以正常形式输出。 输入 输入包含多组数据&#xff0c;每组数据占一行&#xff0c;由两个整数A和B组成&am…...

PGP实现简单加密教程

模拟情景&#xff1a; 假设001和002两位同学的电脑上都安装了PGP&#xff0c;现在两人需要进行加密通讯。 一、创建密钥 1.新建密钥&#xff0c;输入名称和邮箱&#xff0c;输入8位口令&#xff0c;根据指示完成。 2.将其添加到主密钥&#xff0c;鼠标右击出现选项。 这里出…...

7.8 窗体间传递数据

版权声明&#xff1a;本文为博主原创文章&#xff0c;转载请在显著位置标明本文出处以及作者网名&#xff0c;未经作者允许不得用于商业目的 当项目中有多个窗体时&#xff08;在本节中为两个窗体&#xff1a;Form1和Form2&#xff09;&#xff0c;窗体间传递数据有以下几种方…...

一文了解 MCP Server:AI 工具与外部世界的桥梁

引言 随着大语言模型&#xff08;LLM&#xff09;的普及与 AI Agent 的爆发&#xff0c;Anthropic 于 2024 年底提出并开源的 Model Context Protocol&#xff08;MCP&#xff0c;模型上下文协议&#xff09;成为构建智能体系统的关键基石之一。本文将结合最新的实战经验&#…...

【redis】集群 数据分片算法:哈希求余、一致性哈希、哈希槽分区算法

文章目录 什么是集群数据分片算法哈希求余分片搬运 一致性哈希扩容 哈希槽分区算法扩容相关问题 什么是集群 广义的集群&#xff0c;只要你是多个机器&#xff0c;构成了分布式系统&#xff0c;都可以称为是一个“集群” 前面的“主从结构”和“哨兵模式”可以称为是“广义的…...

基于Springboot的网上订餐系统 【源码】+【PPT】+【开题报告】+【论文】

网上订餐系统是一个基于Java语言和Spring Boot框架开发的Web应用&#xff0c;旨在为用户和管理员提供一个便捷的订餐平台。该系统通过简化餐饮订购和管理流程&#xff0c;为用户提供快速、高效的在线订餐体验&#xff0c;同时也为管理员提供完善的后台管理功能&#xff0c;帮助…...

Redis常见面试问题汇总

Redis 面试笔记整理 一、Redis 基础知识1. Redis 概述Redis 是什么&#xff1f;主要特点有哪些&#xff1f;Redis 和 Memcached 的区别是什么&#xff1f;Redis 是单线程还是多线程&#xff1f;为什么单线程还能高效&#xff1f;Redis 6.0 之后的多线程模型是怎样的&#xff1f…...

【redis】集群 如何搭建集群详解

文章目录 集群搭建1. 创建目录和配置2. 编写 docker-compose.yml完整配置文件 3. 启动容器4. 构建集群超时 集群搭建 基于 docker 在我们云服务器上搭建出一个 redis 集群出来 当前节点&#xff0c;主要是因为我们只有一个云服务器&#xff0c;搞分布式系统&#xff0c;就比较…...