SeregPie / VueWordCloud

Generates a cloud out of the words.
https://seregpie.github.io/VueWordCloud/
MIT License
376 stars 59 forks source link

How to use in vue3 #53

Closed bitbitpulse closed 1 year ago

brokelyn commented 2 years ago

I tried to migrate it to Vue3 but yet no success (no more errors but nothing to see). But here are some tips for the migration if anyone will try further:

after that most of the errors are gone but neither of the two examples in the README produced an output for me. Maybe someone can do more research on this.

rahulkumarsingh73690 commented 1 year ago

Any update on vue3/nuxt3?

lovery commented 1 year ago

@rahulkumarsingh73690 check out this PR 56 I have an app based on vue3 and it works good.

SeregPie commented 1 year ago

Use v19.

rahulkumarsingh73690 commented 1 year ago

Please provide demo how to use in vue 3 and nuxt 3

Neil-Lin commented 11 months ago

Nuxt 3 I create a file useWordCloud.js in composables

import VueWordCloud from 'vuewordcloud'
export default function () {
  return {
    VueWordCloud
  }
}

in .vue

<template>
  <div>
    <vue-word-cloud
      style="height: 480px; width: 640px"
      :words="[
        ['romance', 19],
        ['horror', 3],
        ['fantasy', 7],
        ['adventure', 3]
      ]"
      :color="([, weight]: [string, number]) => (weight > 10 ? 'DeepPink' : weight > 5 ? 'RoyalBlue' : 'Indigo')"
      font-family="Roboto"
    />
  </div>
</template>

<script setup lang="ts">
const { VueWordCloud } = useWordCloud()
</script>

It works for me.