optimize: ♻️ 调整目录结构
This commit is contained in:
parent
082aa2e29e
commit
05a4a63df7
|
@ -4,5 +4,5 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Rect from '@/views/shape/rect.vue';
|
||||
import Rect from '@/views/shapes/shape/rect.vue';
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<div id="container"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
import Konva from 'konva/lib/index';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const { width, height } = useWindowSize();
|
||||
const initial = () => {
|
||||
const stage = new Konva.Stage({
|
||||
container: 'container',
|
||||
width: width.value,
|
||||
height: height.value,
|
||||
});
|
||||
|
||||
const layer = new Konva.Layer({ draggable: true });
|
||||
|
||||
layer.add(
|
||||
new Konva.RegularPolygon({
|
||||
x: 100,
|
||||
y: 150,
|
||||
sides: 6,
|
||||
radius: 70,
|
||||
fill: 'red',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
}),
|
||||
);
|
||||
|
||||
stage.add(layer);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initial();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<div id="container"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
import Konva from 'konva/lib';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const { width, height } = useWindowSize();
|
||||
const initial = () => {
|
||||
const stage = new Konva.Stage({
|
||||
container: 'container',
|
||||
width: width.value,
|
||||
height: height.value,
|
||||
});
|
||||
|
||||
const layer = new Konva.Layer({ draggable: true });
|
||||
|
||||
layer.add(
|
||||
new Konva.Arrow({
|
||||
x: 100,
|
||||
y: 150,
|
||||
points: [0, 10, 100, 100],
|
||||
pointerLength: 20,
|
||||
fill: 'red',
|
||||
stroke: 'black',
|
||||
strokeWidth: 2,
|
||||
}),
|
||||
);
|
||||
|
||||
stage.add(layer);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initial();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<template>
|
||||
<div id="container"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
import Konva from 'konva/lib';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const { width, height } = useWindowSize();
|
||||
|
||||
const initial = () => {
|
||||
const stage = new Konva.Stage({
|
||||
container: 'container',
|
||||
width: width.value,
|
||||
height: height.value,
|
||||
});
|
||||
|
||||
const layer = new Konva.Layer({ draggable: true });
|
||||
|
||||
const cuttomShape = new Konva.Shape({
|
||||
x: 16,
|
||||
y: 30,
|
||||
width: width.value/2,
|
||||
height: height.value/2,
|
||||
sceneFunc(context, shape) {
|
||||
context.beginPath();
|
||||
|
||||
context.rect(0, 0, shape.getAttr('width'), shape.getAttr('height'));
|
||||
context.fillStrokeShape(shape);
|
||||
},
|
||||
fill: '#00D2FF',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
});
|
||||
|
||||
layer.add(cuttomShape);
|
||||
stage.add(layer);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initial();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
<template>
|
||||
<div id="container"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue