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)

查看这个大佬文章

相关推荐
还有多远.17 小时前
jsBridge接入流程
前端·javascript·vue.js·react.js
w2sfot17 小时前
Passing Arguments as an Object in JavaScript
开发语言·javascript·ecmascript
烛阴17 小时前
【TS 设计模式完全指南】从零到一:掌握TypeScript建造者模式,让你的对象构建链式优雅
javascript·设计模式·typescript
郝学胜-神的一滴17 小时前
避免使用非const全局变量:C++中的最佳实践 (C++ Core Guidelines)
开发语言·c++·程序人生
ue星空17 小时前
月2期学习笔记
学习·游戏·ue5
搞一搞汽车电子18 小时前
S32K3平台eMIOS 应用说明
开发语言·驱动开发·笔记·单片机·嵌入式硬件·汽车
前端Hardy18 小时前
HTML&CSS:有趣的漂流瓶
前端·javascript·css
前端Hardy18 小时前
HTML&CSS :惊艳 UI 必备!卡片堆叠动画
前端·javascript·css
无羡仙18 小时前
替代 Object.freeze 的精准只读模式
前端·javascript
总有刁民想爱朕ha18 小时前
车牌模拟生成器:Python3.8+Opencv代码实现与商业应用前景(C#、python 开发包SDK)
开发语言·python·数据挖掘