The <no-ssr> 组件

该组件用于设置组件不在服务器渲染中呈现。

Props:

  • placeholder: string
    • 使用文本作为占位符,<no-ssr />组件在客户端中呈现。
  1. <template>
  2. <div>
  3. <sidebar />
  4. <no-ssr placeholder="Loading...">
  5. <!-- 此组件仅在客户端呈现 -->
  6. <comments />
  7. </no-ssr>
  8. </div>
  9. </template>

Slots:

  • placeholder:

    • 使用slot作为占位符,<no-ssr />组件在客户端中呈现。
<template>
<div>
  <sidebar />
  <no-ssr>
    <!-- 此组件仅在客户端呈现 -->
    <comments />

    <!-- loading indicator -->
    <comments-placeholder slot="placeholder" />
  </no-ssr>
</div>
</template>

这个组件是克隆至 egoist/vue-no-ssr. 感谢 @egoist!