JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1298
  • Score
    100M100P100Q105590F
  • License MIT

Telegram integration for Vue

Package Exports

  • vue-tg

Readme

vue-tg - Telegram integration for Vue

A package for integration of Telegram Mini Apps feature with Vue.

Documentation »

Usage Example

<script lang="ts" setup>
  import { MainButton, useWebAppPopup } from 'vue-tg'

  const { showAlert } = useWebAppPopup()
</script>

<template>
  <MainButton text="Open alert" @click="() => showAlert('Hello!')" />
</template>

Installation

To connect your Mini App to the Telegram client, place the script telegram-web-app.js in the <head> tag before any other scripts, using this code:

<script src="https://telegram.org/js/telegram-web-app.js"></script>

After that, install package:

npm i vue-tg

(Optional) Register on Vue instance:

import VueTelegram from 'vue-tg'

Vue.use(VueTelegram)

After that, you can use global aliases for components

<script lang="ts" setup>
  import { Alert } from 'vue-tg'
</script>

<template>
  <Alert message="Hello!" />
</template>

<!-- Same with using an alias of the component -->

<template>
  <tg-alert message="Hello!" />
</template>

Documentation

Components

Composables