File size: 706 Bytes
4d70170 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<script setup>
import { computed, reactive, ref } from 'vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
import Child from './Child.vue'
const myObj = reactive({
foo: 'bar',
})
const count = ref(0)
const double = computed(() => count.value * 2)
const answer = 42
const state2 = reactive({
n: ref(0),
})
function onClick() {
count.value++
}
const throws = computed(() => {
throw new Error('oops')
})
const store = useStore()
const throwsWithVuex = computed(() => store.getters.throws)
const router = useRouter()
</script>
<template>
{{ count }}
{{ double }}
<button @click="onClick">
+1
</button>
<Child />
<pre>{{ state2 }}</pre>
</template>
|