Skip to content

Commit 6bf89b0

Browse files
committed
feat: add functional vue demo
1 parent aa6d7de commit 6bf89b0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

examples/with-vue-3/src/App.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
<script setup lang="ts">
22
import HelloWorld from './components/HelloWorld.vue'
33
import TheWelcome from './components/TheWelcome.vue'
4+
import { ref } from 'vue'
5+
6+
const inputValue = ref('')
7+
8+
function submit() {
9+
console.log('Input Value:', inputValue.value)
10+
if (inputValue.value === 'wrong') {
11+
throw new Error(`Input value "${inputValue.value}" is wrong!`)
12+
}
13+
alert(`Submitted inputValue "${inputValue.value}"`)
14+
}
15+
16+
417
</script>
518

619
<template>
@@ -9,6 +22,8 @@ import TheWelcome from './components/TheWelcome.vue'
922

1023
<div class="wrapper">
1124
<HelloWorld msg="You did it!" />
25+
<input v-model="inputValue" placeholder="Don't input wrong" />
26+
<button @click="submit">Submit</button>
1227
</div>
1328
</header>
1429

0 commit comments

Comments
 (0)