Vite
Installation
Follow the installation docs in the Introduction.
Usage
In any component, import Tweet from vue-better-tweet and use it like so:
<script setup lang="ts">
import { Tweet } from 'vue-better-tweet'
</script>
<template>
<Tweet id="1628832338187636740" />
</template>You can learn more about Tweet in the Twitter theme docs.
Running the test app
Clone the vue-better-tweet (opens in a new tab) repository and then run the following command:
pnpm install && pnpm dev --filter=vite-app...The app will be up and running at http://localhost:5173 (opens in a new tab) for the Vite app example (opens in a new tab).
The app shows the usage of vue-better-tweet in different scenarios:
- localhost:5173/ (opens in a new tab) renders a single tweet.
- localhost:5173/tweet/2014481742875521242 (opens in a new tab) renders dynamic tweets with SWR.
Tweetalready uses SWR and this page shows how to implement it manually.
The source code for vue-better-tweet is imported from packages/vue-better-tweet (opens in a new tab) and any changes you make to it will be reflected in the app immediately.