console
new Vue({
data() {
return {
aaa: '111'
}
},
mounted() {
var bbb = this;
var words = []
for (var i = 0; i < 100; i++) {
words.push(['蛤蛤', 10])
}
for (var i = 0; i < 100; i++) {
words.push(['记者', 10])
}
var option = {
tooltip: {
show: true,
formatter: function(item) {
return item[0] + ': 跑得比较快' + item[1] + 'km/h<br>' + '词云图'
}
},
list: words,
color: '#15a4fa',
imageShape: 'https://liangbizhi.github.io/js2wordcloud/shape/twitter.png',
ellipticity: 1,
click() {
bbb.aaa = 222
}
}
var wc = new Js2WordCloud(document.getElementById('aaaa'))
wc.showLoading({
backgroundColor: '#fff',
text: '正在加载报道...',
effect: 'spin'
})
setTimeout(function() {
wc.hideLoading()
wc.setOption(option)
}, 2000)
}
}).$mount('#app')
<div id="app">
{{aaa}}
<div id="aaaa" style="width: 300px; height: 300px;"></div>
</div>