&"> Vue.js project error: Variable cannot be accessed before initialization-PHP Chinese Network Q&A
Vue.js project error: Variable cannot be accessed before initialization
P粉897881626
P粉897881626 2023-08-25 22:40:48
0
1
536

I'm currently developing a Twitter clone using Vue 3. The source code for the same can be found here.

HomeView.vueThe code is as follows:

  

But after performing the same operation, I am getting the following error in the developer's console.

Uncaught (in promise) ReferenceError: Cannot access 'tweets' before initialization

P粉897881626
P粉897881626

reply all (1)
P粉020556231

Not a composition API expert, but I wanted to take a look at thelifecycle a>, you can't use tweets directly like this because they are not usable directly. They will then be filled.

Although your template is synchronized, it will error because it cannot access something when it is (originally) undefined.

Making

may be a solution, otherwise it may be withwatchandsuspense, not sure.

PS: There are 2 moretweetsvariables here, which may cause some errors, please be careful.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!