最终效果

js代码
option() {
const title = this.chartData.source
? `{title| ${this.chartData.title}}{source| ${this.chartData.source} }`
: `{title| ${this.chartData.title}}`
return{
title: {
text: title,
top: 18,
left: 13,
textStyle: {
rich: {
title: {
color: '#2D2E32',
fontFamily: 'MicrosoftYaHei',
fontSize: 14,
fontWeight: 400,
lineHeight: 16,
cursor: 'pointer',
padding: [0, 15, 0, 0]
},
source: {
fontSize: 12,
fontFamily: 'MicrosoftYaHei',
color: '#9A9CA1',
padding: [6, 9, 7, 9],
backgroundColor: 'rgba(235, 236, 239, 0.4)',
borderRadius: 6
}
},
lineHeight: 16
}
}
}