Vue中使用export default時遇到問題
P粉769413355
P粉769413355 2023-09-12 17:20:02
0
1
513

程式碼錯誤

我嘗試運行上述程式碼,但是無法運行,在瀏覽器中也看不到任何內容。 有沒有其他方法來寫<scripts setup> </script>中的程式碼?我學到的是函數放在 export default { name: 'App', //code }中 因為當我輸入其他任何內容時,例如console.log('It runs'),我會得到一個錯誤,甚至看不到'hello world'?請幫忙 ;-;

P粉769413355
P粉769413355

全部回覆(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>
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!