W
W
WebDev2018-12-17 20:13:59
Vue.js
WebDev, 2018-12-17 20:13:59

Why does nuxt complain about the form tag?

I get an error

[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

At random, I came to the conclusion that the error crashes when the tag is inserted
<div class="dummy" :class="{visible: customServiceDummy}" @click="hideDummy">
            <div class="dummy-content" @click="closeCustomImagesList">
                <div @click="hideDummy" class="dummy-close-icon icon-close"></div>

                    <form class="custom-service-form" @submit.prevent="saveCustomService">
                    <!--Разметка внутри form-->
            </div>
</div>

If you remove the form tag from the code above, but leave everything inside, then there is no error. What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EldarKin, 2020-04-03
@EldarKin

Most likely he swears on separate elements in the form. Try to find which elements it swears at (using the exclusion method) and wrap them in a tag . In my case, it was the @nuxtjs/vuetify plugin, the components of which I used inside the form, and for this plugin I also had to add the option to disable ssr during initialization.
<client-only></client-only>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question