本帖最后由 18979425409 于 2023-12-4 10:09 编辑
通过ajax的方式给低代码添加启动界面。
步骤:
1.制作html的启动界面
2.在低代码中添加启动界面
3.当场景加载完成之后,隐藏启动界面
4.整体代码
- // 加载场景代码
- var app = new THING.App({
- url: "/api/scene/508bf8b7220b917648d3b86c", // 场景地址
- background: '#000000',
- env: 'Seaside',
- });
- // ajax请求文件
- $.ajax({
- url: '/uploads/wechat/703071/file/启动界面/index.html', //启动界面地址
- type: 'get',
- dataType: 'text',
- success: function (data) {
- // 添加启动界面到页面中
- $('.div2d').append(data);
- // 查看当前场景加载进度
- app.on(THING.EventType.Progress, function (ev) {
- // 得到0-100的整数
- var num = Math.trunc(ev.progress * 100)
- console.log(num)
- })
- }
- })
- app.on('load', function () {
- console.log("资源加载完成,隐藏启动界面")
- // 启动界面的最外面元素的id为loadingDiv
- document.getElementById("loadingDiv").style.display = "none";
- })
复制代码
|
|
|
|
|
|