@tmesoft/2d-teaching-center
v1.2.5
Published
a 2d-teaching-center
Downloads
16
Readme
2d-teaching-center
如何使用
用于渲染2d的实验中心效果
- pnpm i @tmesoft/2d-teaching-center
- 在admin项目中拷贝src/assets/svg/drag-center-icons到自己的项目:src/assets/svg/drag-center-icons下(注意路径要一致)
demo
<!--ts-->
import TeachingCenter from '@tmesoft/2d-teaching-center'
// 监听点击实验室
const labClickHandle = (lab) => {
console.log('lab', lab)
}
const teachingCenterRef = ref()
// 传入json数据
const setJson = (modelData:string)=>{
teachingCenterRef.value?.setJSON(modelData)
}
// 修改实验室状态
// 支持两种状态:using,unused
const changeLabStatus = () => {
teachingCenterRef.value?.setLabStatus(labId, 'using')
}
<!--template-->
<TeachingCenter @onLabClick="labClickHandle" ref="teachingCenterRef" />
方法
| Name | Description | type | default | |--------------|--------------|-------------------------------|---------| | setJSON | 设置模型json内容 | string | '' | | getJSON | 获取组件内的json内容 | | | | setLabStatus | 设置模型的实验室状态 | {labId:string,status:'using'} | |'unused' } | false |
事件
| Name | Description | |------------|-------------------| | onLabClick | 实验室被点击,返回当前实验室的信息 |