Problems encountered when using export default in Vue
P粉769413355
P粉769413355 2023-09-12 17:20:02
0
1
607

Code Error

I tried running the above code, but it didn't work and I couldn't see anything in the browser. Is there any other way to write the code in <scripts setup> </script>? What I learned is that the function is placed in export default { name: 'App', //code }中 Because when I type anything else, like console.log('It runs'), I get an error and can't even see 'hello world'? Please help ;-;

P粉769413355
P粉769413355

reply all(1)
P粉276876663

your code error

// App.vue
<script setup lang="ts">
import { onMounted, reactive, toRefs } from 'vue'

const state = reactive({
    showNavbar: 'xxxx'
})
const { showNavbar } = toRefs(state)

onMounted(async() => {
   console.log('hello world')
})

</script>

<template>

    <main>
         <RouterView />
    </main>
   
</template>

<style lang="scss" scoped>

</style>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template