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粉2768766632023-09-13 09:38:30
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>