ue5.4和webul通信

复制代码
  <script>
    // create the global ue5(...) helper function
    "object" != typeof ue && (ue = {}), uuidv4 = function () { return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (t) { return (t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> t / 4).toString(16) }) }, ue5 = function (r) { return "object" != typeof ue.interface || "function" != typeof ue.interface.broadcast ? (ue.interface = {}, function (t, e, n, o) { var u, i; "string" == typeof t && ("function" == typeof e && (o = n, n = e, e = null), u = [t, "", r(n, o)], void 0 !== e && (u[1] = e), i = encodeURIComponent(JSON.stringify(u)), "object" == typeof history && "function" == typeof history.pushState ? (history.pushState({}, "", "#" + i), history.pushState({}, "", "#" + encodeURIComponent("[]"))) : (document.location.hash = i, document.location.hash = encodeURIComponent("[]"))) }) : (i = ue.interface, ue.interface = {}, function (t, e, n, o) { var u; "string" == typeof t && ("function" == typeof e && (o = n, n = e, e = null), u = r(n, o), void 0 !== e ? i.broadcast(t, JSON.stringify(e), u) : i.broadcast(t, "", u)) }); var i }(function (t, e) { if ("function" != typeof t) return ""; var n = uuidv4(); return ue.interface[n] = t, setTimeout(function () { delete ue.interface[n] }, 1e3 * Math.max(1, parseInt(e) || 0)), n });
  </script>

// 标题点击处理(跳转到首页)
const handleTitleClick = () => {
  router.push('/ecoTrend')
  // 如果需要与UE5通信,可以保留以下代码
  // ue5('callbackTEXT', 'hello 杨涛');
}

// onMounted(() => {
//   aa();
// });

// const aa = () => {
//   ue.interface.getCameraUrl = function (fps) {
//     // set element text
//     title.value = fps;
//     ue5('callbackTEXT', "fps:"+fps);
//   };
// };

ue的代码(call是发送给webui,OnInterfac是接受到ue)

查看这个大佬文章

相关推荐
fwerfv3453452 小时前
C++中的装饰器模式变体
开发语言·c++·算法
GISer_Jing3 小时前
明天好好总结汇总分析博客
前端·javascript·面试
wjs20243 小时前
Perl 错误处理
开发语言
楼田莉子5 小时前
C++学习:C++11介绍及其新特性学习
开发语言·c++·学习·stl·visual studio
做运维的阿瑞5 小时前
Windows 环境下安装 Node.js 和 Vue.js 框架完全指南
前端·javascript·vue.js·windows·node.js
不枯石5 小时前
Matlab通过GUI实现点云的随机一致性(RANSAC)配准
开发语言·图像处理·算法·计算机视觉·matlab
牛马的人生5 小时前
MATLAB模块库入门:提升你的工程分析效率
开发语言·其他·matlab
光电笑映7 小时前
C++list全解析
c语言·开发语言·数据结构·c++·list
恋猫de小郭8 小时前
Fluttercon EU 2025 :Let‘s go far with Flutter
android·开发语言·flutter·ios·golang
小龙报8 小时前
《构建模块化思维---函数(下)》
c语言·开发语言·c++·算法·visualstudio·学习方法