<template>
  <div ref="wordCloud" style="width: 600px; height: 400px;"></div>
</template>
 
<script>
import * as echarts from 'echarts';
import 'echarts-wordcloud';
 
export default {
  mounted() {
    const wordCloud = echarts.init(this.$refs.wordCloud);
    wordCloud.setOption({
      series: [{
        type: 'wordCloud',
        gridSize: 20,
        sizeRange: [20, 50],
        rotationRange: [-90, 90],
        textStyle: {
          normal: {
            color: function () {
              return 'rgb(' +
                Math.round(Math.random() * 255) + ',' +
                Math.round(Math.random() * 255) + ',' +
                Math.round(Math.random() * 255) + ')';
            }
          }
        },
        data: [
          {name: 'Example', value: 10000},
          {name: 'Vue.js', value: 6181},
          {name: 'ECharts', value: 4386},
          // ... 其他词项
        ]
      }]
    });
  }
}
</script>
 
<style>
/* 你的样式 */
</style>