element-plus / element-plus-nuxt-starter

🌰 A starter example for element-plus with Nuxt 3.
https://element-plus-nuxt.vercel.app
MIT License
289 stars 82 forks source link

SSR, Hydration node mismatch #10

Closed 209 closed 2 years ago

209 commented 2 years ago
  <div>
    <el-dropdown>
      <span>
        test
      </span>
      <template #dropdown>
        <div>
          <el-dropdown-menu>
            <el-dropdown-item>Action 1</el-dropdown-item>
            <el-dropdown-item>Action 2</el-dropdown-item>
            <el-dropdown-item>Action 3</el-dropdown-item>
            <el-dropdown-item disabled>Action 4</el-dropdown-item>
            <el-dropdown-item divided>Action 5</el-dropdown-item>
          </el-dropdown-menu>
        </div>
      </template>
    </el-dropdown>
  </div>

https://github.com/209/element-plus-nuxt-starter

Снимок экрана 2021-10-24 в 01 08 22
YunYouJun commented 2 years ago

Nuxt3 is in beta, there are many bugs that have not yet been fixed, and the API is even subject to change, so we hope to wait for it to become more stable before continuing to adapt it.

More info see https://github.com/nuxt/framework/projects/2.

209 commented 2 years ago

It's not a nuxt3 problem. I reproduced the bug with vite: https://github.com/209/vite-ssr-elements-ui

<template>
  <el-dropdown>
    <span>test</span>
    <template #dropdown>
      <div>
        <el-dropdown-menu>
          <el-dropdown-item>Action 1</el-dropdown-item>
          <el-dropdown-item>Action 2</el-dropdown-item>
        </el-dropdown-menu>
      </div>
    </template>
  </el-dropdown>
</template>
<script>
import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus';
export default {
  components: {
    ElDropdown, ElDropdownMenu, ElDropdownItem
  }
};
</script>
Снимок экрана 2021-10-24 в 13 25 20
YunYouJun commented 2 years ago

Try element-plus/lib.

209 commented 2 years ago

I tried. No progress: warning appears

YunYouJun commented 2 years ago

Yeah, I can reproduce it. Maybe it's related to vue ssr, I haven't found a solution for it yet.

209 commented 2 years ago

Sorry, i forgot to add this link: https://github.com/vuejs/vue-next/issues/3989 Maybe it's vue3 problem.

xiaoxian521 commented 2 years ago

This is a problem with vue ssr, let's wait for the fix