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)

查看这个大佬文章

相关推荐
橙橙笔记4 小时前
C++的学习第三部分
开发语言·c++·学习
2603_9651481113 小时前
如何解析JSON数据?API返回的商品信息处理教程
开发语言·数据库·python·自动化·json·api
万少13 小时前
给 DeepSeek Harness 装个"应用商店":一条命令,595 个插件随你逛
前端·javascript·后端
小爬的老粉丝15 小时前
JavaScript 纯前端预览 WPS:先识别容器,再路由解析器
前端·javascript·wps
知无不研16 小时前
lambda表达式的使用(3)
开发语言·c++·lambda
cfm_291416 小时前
SpringAI + Ollama 本地大模型
java·开发语言·人工智能·语言模型
满栀58517 小时前
状态管理:Redux、Vuex、Pinia 核心区别
前端·javascript·typescript
C++ 老炮儿的技术栈17 小时前
基于Qt实现轻量化本地音乐播放器
开发语言·c++·qt·c·播放器·音乐
qq_4480111618 小时前
C语言中的柔性数组
c语言·开发语言·柔性数组
小白学大数据18 小时前
长周期爬虫的数据一致性:断点续爬 + 事务回滚保障采集质量
开发语言·爬虫·测试工具