const getLinearColor = function(color1, color2, pos) {
const p = Object.assign({ x: 0.5, y: 0, x2: 0.5, y2: 1 }, pos)
return {
type: 'linear',
...p,
colorStops: [
{
offset: 0,
color: color1
},
{
offset: 1,
color: color2
}
],
global: false
}
}
export default{
data(){
return{
xxxxx:饼状图值
data里的写法:[
{
value: 250,
name: 'xxxxx',
itemStyle: {
color: getLinearColor(
'rgba(202, 181, 35, 1)',
'rgba(253, 245, 191, 1)'
)
}
]
}
}