VueWordCloud icon indicating copy to clipboard operation
VueWordCloud copied to clipboard

How to use in vue3

Open nintheaven opened this issue 4 years ago • 1 comments

nintheaven avatar Aug 14 '21 05:08 nintheaven

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.

brokelyn avatar Nov 03 '21 11:11 brokelyn

Any update on vue3/nuxt3?

rahulkumarsingh73690 avatar Nov 12 '22 15:11 rahulkumarsingh73690

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

lovery avatar Dec 20 '22 10:12 lovery

Use v19.

SeregPie avatar Jan 20 '23 15:01 SeregPie

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

rahulkumarsingh73690 avatar Jan 20 '23 15:01 rahulkumarsingh73690

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.

Neil-Lin avatar Jul 16 '23 04:07 Neil-Lin