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)

查看这个大佬文章

相关推荐
Carlos_sam1 小时前
OpenLayers:ol-wind之渲染风场图全解析
前端·javascript
java叶新东老师1 小时前
goland编写go语言导入自定义包出现: package xxx is not in GOROOT (/xxx/xxx) 的解决方案
开发语言·后端·golang
拾光拾趣录1 小时前
闭包:从“变量怎么还没死”到写出真正健壮的模块
前端·javascript
檀越剑指大厂1 小时前
【Python系列】Flask 应用中的主动垃圾回收
开发语言·python·flask
拾光拾趣录1 小时前
for..in 和 Object.keys 的区别:从“遍历对象属性的坑”说起
前端·javascript
檀越剑指大厂1 小时前
【Python系列】使用 memory_profiler 诊断 Flask 应用内存问题
开发语言·python·flask
笠码1 小时前
JVM Java虚拟机
java·开发语言·jvm·垃圾回收
橙小花2 小时前
C语言:指针、变量指针与指针变量、数组指针与指针数组
c语言·开发语言
Cyanto2 小时前
MyBatis-Plus高效开发实战
java·开发语言·数据库
艾莉丝努力练剑2 小时前
【LeetCode&数据结构】二叉树的应用(二)——二叉树的前序遍历问题、二叉树的中序遍历问题、二叉树的后序遍历问题详解
c语言·开发语言·数据结构·学习·算法·leetcode·链表