案例展示
创建坐标轴、删除坐标轴
<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 | 删除坐标轴 |