🐛 ChoroplethLayer组件的onCreated方法中监听不到legend的变化
Dreammy23 opened this issue · comments
Dreammy23 commented
/### 使用ChoroplethLayer行政区下钻组件时,想监听 legend 改变的方法,发现没有生效
<ChoroplethLayer
id="boundsLayer"
autoFit: true,
fillColor: {
field: 'predictsValue',
value: [
'#fadfce',
'#ffbb96',
'#ff8f5b',
'#fc6e35',
'#f03c21',
]
},
zIndex: 0,
opacity: 0.8,
lineWidth: 1,
label: {
field: 'areaName',
visible: true,
style: { fill: 'black', fontSize: 12, stroke: '#fff', strokeWidth: 1 },
},
source={{ data: boundData }}
onCreated={(layer) => {
layer?.on('legend:color', () => console.log('监听legend:color')); // 无效,没有打印语句
layer?.on('legend', () => console.log('监听legend')); // 无效,没有打印语句
layer?.on('dataUpdate', () => console.log('监听legend')); // 生效,有打印语句
}}
/>