-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support all state props + options API
- Loading branch information
Showing
10 changed files
with
264 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script> | ||
export default { | ||
data () { | ||
return { | ||
optionApiData: 'OPTION API', | ||
} | ||
}, | ||
} | ||
</script> | ||
|
||
<template> | ||
<Story> | ||
<Variant> | ||
<h1>State</h1> | ||
<div> | ||
<pre>{{ { optionApiData } }}</pre> | ||
<input | ||
v-model="optionApiData" | ||
> | ||
</div> | ||
|
||
<template #controls> | ||
<HstText | ||
v-model="optionApiData" | ||
title="optionApiData" | ||
/> | ||
</template> | ||
</Variant> | ||
</Story> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<script lang="ts"> | ||
import { reactive, ref } from 'vue' | ||
export default { | ||
setup () { | ||
const state = reactive({ | ||
count: 0, | ||
text: 'Meow', | ||
}) | ||
const synced = ref('hello') | ||
return { | ||
state, | ||
synced, | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<Story> | ||
<Variant | ||
title="default" | ||
> | ||
<h1>State</h1> | ||
<div> | ||
<pre>{{ state }}</pre> | ||
<div>{{ { synced } }}</div> | ||
<input | ||
v-model.number="state.count" | ||
type="number" | ||
> | ||
<input | ||
v-model="state.text" | ||
> | ||
<input | ||
v-model="synced" | ||
> | ||
</div> | ||
|
||
<template #controls> | ||
<div class="controls"> | ||
<button @click="state.count--"> | ||
-1 | ||
</button> | ||
<button @click="state.count++"> | ||
+1 | ||
</button> | ||
<span>{{ state.count }}</span> | ||
</div> | ||
|
||
<HstText | ||
v-model="state.text" | ||
title="Text" | ||
/> | ||
|
||
<HstText | ||
v-model="synced" | ||
title="synced" | ||
/> | ||
</template> | ||
</Variant> | ||
</Story> | ||
</template> | ||
|
||
<style scoped> | ||
.controls { | ||
margin: 12px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.controls > :not(:first-child) { | ||
margin-left: 12px; | ||
} | ||
button { | ||
padding: 6px; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ html.htw-dark { | |
background: #27272a ; | ||
color: #e9e9ed; | ||
} | ||
|
||
input { | ||
border: solid 1px #ccc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.