API Overview
The VrmCanvas component has three kinds of API, and the package also exports helper functions:
The VrmCanvas component has three kinds of API, and the package also exports helper functions:
| Page | Content |
|---|---|
| Props | Options for the model, animation, canvas, camera, and lights. |
| Events | Notifications for loading, animation, camera and light changes, and errors. |
| Instance API | Methods available through a template ref. |
| Utilities | Functions for validating and loading VRM / VRMA buffers without the component. |
<script setup lang="ts">
import { ref } from 'vue';
import { VrmCanvas, type VrmCanvasExposed } from 'vue-vrm';
const modelData = ref<ArrayBuffer>();
const canvas = ref<VrmCanvasExposed>();
</script>
<template>
<VrmCanvas
ref="canvas"
:model-data="modelData"
show-grid
@model:loaded="() => canvas?.resetCamera()"
/>
</template>