"use client"; import React, { useState, useEffect } from "react"; import Image from "next/image"; export default function GenerateLink({ params }) { //生成二维码 const [qrcodeUrl, setQrcodeUrl] = useState(""); useEffect(() => { var QRCode = require("qrcode"); QRCode.toDataURL( `https://tiefen.fun/${params.user_id}`, function (err, url) { setQrcodeUrl(url); } ); }, []); //保存图片 const saveImage = async () => { window.ReactNativeWebView.postMessage( JSON.stringify({ type: "SAVE_IMAGE", data: qrcodeUrl, }) ); }; //复制链接 const copyUrl = () => { window.ReactNativeWebView.postMessage( JSON.stringify({ type: "COPY_URL", data: `https://tiefen.fun/${params.user_id}`, }) ); }; return (

已为您生成专属链接与二维码

请扫码或复制到浏览器查看

https://tiefen.fun/{params.user_id}

); }