mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-15 20:26:52 +08:00
refactor: rename realListeners to listeners
This commit is contained in:
@ -93,11 +93,10 @@ export default defineComponent({
|
|||||||
const nonEventAttrs = computed(() => omitOn(attrs));
|
const nonEventAttrs = computed(() => omitOn(attrs));
|
||||||
const nativeListeners: Record<string, unknown> = {};
|
const nativeListeners: Record<string, unknown> = {};
|
||||||
|
|
||||||
const realListeners: Record<string, any> = {};
|
const listeners: Record<string, any> = {};
|
||||||
|
|
||||||
// We are converting all `on<Event>` props to event listeners compatible with Vue 2
|
// We are converting all `on<Event>` props and collect them into `listeners` so that
|
||||||
// and collect them into `realListeners` so that we can bind them to the chart instance
|
// we can bind them to the chart instance later.
|
||||||
// later in the same way.
|
|
||||||
// For `onNative:<event>` props, we just strip the `Native:` part and collect them into
|
// For `onNative:<event>` props, we just strip the `Native:` part and collect them into
|
||||||
// `nativeListeners` so that we can bind them to the root element directly.
|
// `nativeListeners` so that we can bind them to the root element directly.
|
||||||
Object.keys(attrs)
|
Object.keys(attrs)
|
||||||
@ -124,7 +123,7 @@ export default defineComponent({
|
|||||||
event = `~${event.substring(0, event.length - 4)}`;
|
event = `~${event.substring(0, event.length - 4)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
realListeners[event] = attrs[key];
|
listeners[event] = attrs[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
function init(option?: Option) {
|
function init(option?: Option) {
|
||||||
@ -142,8 +141,8 @@ export default defineComponent({
|
|||||||
instance.group = props.group;
|
instance.group = props.group;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(realListeners).forEach(key => {
|
Object.keys(listeners).forEach(key => {
|
||||||
let handler = realListeners[key];
|
let handler = listeners[key];
|
||||||
|
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user