Skip to content

optimatica-meters-vue

Vue 3 компонент MeterPhotoAnalyzer — загрузка, камера, отправка и отображение результата.

Playground

Попробуйте компонент в браузере: Vue SDK Playground.

Установка

bash
npm install optimatica-meters-vue optimatica-meters

Peer dependency: Vue ^3.5

Подключение

ts
// main.ts
import { createApp } from 'vue'
import { configureZhkhSdk } from 'optimatica-meters-vue'
import App from './App.vue'

configureZhkhSdk({ apiKey: 'eyJhbGci...' })

createApp(App).mount('#app')
vue
<script setup lang="ts">
import { MeterPhotoAnalyzer } from 'optimatica-meters-vue'
import 'optimatica-meters-vue/style.css'
</script>

<template>
  <MeterPhotoAnalyzer api-key="eyJhbGci..." />
</template>

Vue plugin

ts
import { createZhkhSdkPlugin } from 'optimatica-meters-vue'

app.use(createZhkhSdkPlugin({
  apiKey: 'eyJhbGci...',
}))
// регистрирует глобально <ZhkhMeterPhotoAnalyzer />

Props

PropТипПо умолчаниюОписание
apiKeystringAPI-ключ (JWT)
showApiKeyInputbooleanautoПоле ввода ключа
showRawJsonbooleanfalseПоказать сырой JSON-ответ
disabledbooleanfalseОтключить UI

Events

EventPayload
analyze-startFile
success{ success: true, meter }
errorstring
complete(response, error)

Composable

ts
import { useMeterAnalyze } from 'optimatica-meters-vue'

const { isLoading, response, error, analyze, reset } = useMeterAnalyze()

Стили

ts
import 'optimatica-meters-vue/style.css'

Компонент использует scoped CSS с префиксом zhkh-analyzer__* и CSS-переменными — работает без Tailwind.

MIT License