import Konva from 'konva';
const stage = new Konva.Stage({
container: 'container',
width: window.innerWidth,
height: window.innerHeight,
});
const layer = new Konva.Layer();
stage.add(layer);
const circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4,
});
circle.on('click.event1', function () {
alert('第一个点击监听器');
});
circle.on('click.event2', function () {
alert('第二个点击监听器');
});
layer.add(circle);
const button1 = document.createElement('button');
button1.innerHTML = '移除第一个监听器';
button1.style.position = 'absolute';
button1.style.top = '0';
button1.style.left = '0';
document.getElementById('container').appendChild(button1);
const button2 = document.createElement('button');
button2.innerHTML = '移除第二个监听器';
button2.style.position = 'absolute';
button2.style.top = '30px';
button2.style.left = '0';
document.getElementById('container').appendChild(button2);