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

Can not use css #18

Closed alanhzw closed 2 years ago

alanhzw commented 2 years ago

the button's color is #ffffff

image

alanhzw commented 2 years ago

Hello Default Primary Success Info Warning Danger 中文

所有类型的button都是白色的

polly3d commented 2 years ago

Same issue here.

YunYouJun commented 2 years ago

element-plus still can not work well with nuxt3. And nuxt3 still being updated and have not yet been released stavle version.

Please just wait.

calebeaires commented 2 years ago

@YunYouJun, it is true, but may you give us a clue of what is missing so we can try to make some progress?

YunYouJun commented 2 years ago

@calebeaires Sorry, I don't know why too.

calebeaires commented 2 years ago

Make it work using client only wrapper

<template>
  <main>
    <ClientOnly>
      <NuxtPage />
    </ClientOnly>
  </main>
</template>

I think the way Element-plus set ccs variables in the button html is not compatible with the "rendering server time"!

xiaoxian521 commented 2 years ago

Make it work using client only wrapper

<template>
  <main>
    <ClientOnly>
      <NuxtPage />
    </ClientOnly>
  </main>
</template>

I think the way Element-plus set ccs variables in the button html is not compatible with the "rendering server time"!

Thanks for the feedback, I will investigate this

xiaoxian521 commented 2 years ago

The reason for this problem is that the dynamically calculated style is not loaded in nuxt abnormal (ssr)

image

normal (not ssr)

image

Specific code

image
estudiooka commented 2 years ago

+1 Same here since the first release of element-plus. Inline styles are not inject with SSR. Client only is not a realiable solution.

estudiooka commented 2 years ago

Also to make it compatible with nuxt should be an option to render the button as a nuxt-link component.

xiaoxian521 commented 2 years ago

Also to make it compatible with nuxt should be an option to render the button as a nuxt-link component.

This issue has been resolved, upgrade element-plus to the latest version