Skip to content

案例展示

创建坐标轴、删除坐标轴

<template>
    <div style="position: relative;">
        <div id="TO"></div>

        <el-button type="primary" size="small" id="show" @click="show()">显示</el-button>
        <el-button type="primary" size="small" id="hide" @click="hide()">删除</el-button>
    </div>
</template>

<script setup>
import { onMounted } from 'vue'
let TO = null;
onMounted(() => {
    //初始化场景
    TO = new ThingOrigin("fileModel", document.getElementById("TO"), {
        scene: {//场景
            ground: { //地面
                active: false
            }
        },
    });
    show()
})


//显示
function show() {
    TO.helper.initAxes(100);
}

//删除
function hide() {
    TO.helper.removeAxes();
}


</script>

<style scoped>
#TO {
    width: 100%;
    height: 400px;
    position: relative;
}

#show {
    position: absolute;
    top: 10px;
    right: 70px;
}

#hide {
    position: absolute;
    top: 10px;
    right: 10px;
}
</style>

API 介绍

helper.initAxes

方法签名返回值描述
initAxes(len: number = 50)void创建坐标轴

参数说明:

参数名说明类型必填默认值
len长度number-50

helper.removeAxes

方法签名返回值描述
removeAxes()void删除坐标轴