快速开始
只需一行代码,即可将 AR 试戴功能集成到你的网站中。
<script src="https://ar.smmxys.com/sdk/v1.js"></script>
<script>
SmartAR.init({
container: '#ar-container',
apiKey: 'YOUR_API_KEY',
products: [
{ id: 'ring-001', model: '/models/ring.glb' },
{ id: 'necklace-001', model: '/models/necklace.glb' }
]
});
</script>
配置选项
SmartAR.init() 方法支持以下配置参数:
container: string - AR 容器元素的选择器
apiKey: string - 你的 API Key
products: Array - 产品配置数组
autoStart: boolean - 是否自动启动摄像头
defaultProduct: string - 默认显示的产品ID