参考效果

代码如下:
<div class="article-right-card article-detail-hot-label">
<div class="right-card-title">
热门标签
</div>
<div class="right-card-content">
<WordCloud></WordCloud>
</div>
</div>
需要添加的依赖:
"vue-wordcloud": "^1.1.1"
绑定data就有了,属性有这些
const props = {
margin: {
type: Object,
default: function () {
return {
top: 15,
right: 15,
bottom: 15,
left: 15
}
}
},
wordPadding: {
type: Number,
default: 3
},
rotate: {
type: Object,
default: function () {
return {
from: -60,
to: 60,
numOfOrientation: 5
}
}
},
spiral: { // two built-in spirals: "archimedean" and "rectangular"
type: String,
default: 'archimedean'
},
fontScale: {
type: String,
default: 'sqrt'
},
font: {
type: String,
default: 'impact'
},
fontSize: {
type: Array,
default: function () {
return [10, 80]
}
},
color: {
type: [String, Array], // using d3 color schemes or self defined colors
default: 'Category10'
},
data: {
type: Array,
required: true
},
nameKey: {
type: String,
default: 'name'
},
valueKey: {
type: String,
default: 'value'
},
showTooltip: {
type: Boolean,
default: true
},
wordClick: {
type: Function,
default: null
}
}
就这样子吧,应该水够了。















