代码错误
我尝试运行上述代码,但是无法运行,在浏览器中也看不到任何内容。
有没有其他方法来编写<scripts setup> </script>中的代码?我学到的是函数放在
export default { name: 'App', //code }中
因为当我输入其他任何内容时,比如console.log('It runs'),我会得到一个错误,甚至看不到'hello world'?请帮帮忙 ;-;
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
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>