Skip to content

Commit 55e8c09

Browse files
committed
feat(client): new arrow component
1 parent 7461a4d commit 55e8c09

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

packages/client/builtin/Arrow.vue

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!--
2+
3+
Simple Arrow
4+
5+
<arrow x1="10" y1="20" x2="100" y2="200" color="green" width="3" />
6+
7+
<arrow v-bind="{ x1:10, y1:10, x2:200, y2:200 }"/>
8+
9+
-->
10+
11+
<script setup lang="ts">
12+
import { defineProps } from 'vue'
13+
14+
defineProps<{
15+
x1: number | string
16+
y1: number | string
17+
x2: number | string
18+
y2: number | string
19+
width?: number | string
20+
color?: string
21+
}>()
22+
</script>
23+
24+
<template>
25+
<svg
26+
class="absolute left-0 top-0 pointer-events-none"
27+
:width="Math.max(+x1, +x2) + 50"
28+
:height="Math.max(+y1, +y2) + 50"
29+
>
30+
<defs>
31+
<marker
32+
id="arrowhead"
33+
markerUnits="strokeWidth"
34+
:markerWidth="10"
35+
:markerHeight="7"
36+
refX="9"
37+
refY="3.5"
38+
orient="auto"
39+
>
40+
<polygon points="0 0, 10 3.5, 0 7" :fill="color || 'currentColor'" />
41+
</marker>
42+
</defs>
43+
<line
44+
:x1="+x1"
45+
:y1="+y1"
46+
:x2="+x2"
47+
:y2="+y2"
48+
:stroke="color || 'currentColor'"
49+
:stroke-width="width || 2"
50+
marker-end="url(#arrowhead)"
51+
/>
52+
</svg>
53+
</template>

packages/create-app/template/slides.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,15 @@ interface User {
110110
role: string
111111
}
112112

113-
function updateUser(id: number, update: Partial<User>) {
113+
function updateUser(id: number, update: User) {
114114
const user = getUser(id)
115115
const newUser = {...user, ...update}
116116
saveUser(id, newUser)
117117
}
118118
```
119119

120+
<arrow v-click="3" x1="400" y1="420" x2="230" y2="330" color="#564" width="3" arrowSize="1" />
121+
120122
---
121123

122124
# Components

0 commit comments

Comments
 (0)