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)

查看这个大佬文章

相关推荐
www_stdio4 分钟前
我的猫终于打上冰球了——一个 Vue3 + Coze AI 项目的完整落地手记
javascript·vue.js·coze
MediaTea12 分钟前
思考与练习(第十章 文件与数据格式化)
java·linux·服务器·前端·javascript
Matlab光学17 分钟前
MATLAB仿真:离轴干涉法实现光学全息加密与解密
开发语言·matlab
江公望21 分钟前
Vue3的 nextTick API 5分钟讲清楚
前端·javascript·vue.js
小鸡吃米…27 分钟前
Python - JSON
开发语言·python·json
JAVA+C语言31 分钟前
C#——接口
开发语言·c#
黎雁·泠崖32 分钟前
吃透指针通用用法:回调函数与 qsort 的使用和模拟
c语言·开发语言
whn197732 分钟前
达梦数据库的整体负载变化查看
java·开发语言·数据库
脏脏a34 分钟前
聊聊 C 里的进制转换、移位操作与算术转换
c语言·开发语言·移位操作符
陳103036 分钟前
C++:string(4)
开发语言·c++