page: 📄 添加和移出事件
This commit is contained in:
parent
1a1bb6893d
commit
0ceec1f86d
|
@ -15,6 +15,7 @@ import { Circle } from 'konva/lib/shapes/Circle';
|
|||
const { width, height } = useWindowSize();
|
||||
const circle = ref<Circle>();
|
||||
const text = ref<Text>();
|
||||
const count = ref(0);
|
||||
|
||||
const initial = () => {
|
||||
const stage = new Konva.Stage({ container: 'container', width: width.value, height: height.value });
|
||||
|
@ -44,7 +45,8 @@ const initial = () => {
|
|||
|
||||
// 添加事件
|
||||
circle.value?.on('click', function () {
|
||||
text.value?.text('点击了');
|
||||
text.value?.text(`点击了:${count.value}`);
|
||||
count.value++;
|
||||
});
|
||||
|
||||
stage.add(layer);
|
||||
|
|
Loading…
Reference in New Issue