import { jsx, jsxs, Fragment } from 'solid-jsx/jsx-runtime';

/*@jsxRuntime automatic @jsxImportSource solid-jsx*/
const toc = [];
function _createMdxContent(props) {
  const _components = Object.assign({
    p: "p",
    code: "code",
    pre: "pre",
    span: "span"
  }, props.components);
  return jsxs(Fragment, {
    children: [jsxs(_components.p, {
      children: ["某些时候你可能有多个要协调的 ", jsx(_components.code, {
        children: "Suspense"
      }), " 组件。一种方法是将所有内容都放在一个 ", jsx(_components.code, {
        children: "Suspense"
      }), " 下，但这将子组件限制成单一的加载行为。单一的回退状态意味着一切都需要等到最后一件事被加载。所以，Solid 引入了 ", jsx(_components.code, {
        children: "SuspenseList"
      }), " 组件来协调这些组件。"]
    }), "\n", jsxs(_components.p, {
      children: ["考虑像我们的例子一样有多个 ", jsx(_components.code, {
        children: "Suspense"
      }), " 组件。如果我们将 ", jsx(_components.code, {
        children: "SuspenseList"
      }), " 的 ", jsx(_components.code, {
        children: "revealOrder"
      }), " 属性配置为 ", jsx(_components.code, {
        children: "forwards"
      }), " 来包裹内容，子组件将按照它们在树中出现的顺序呈现，而不管它们加载的顺序。这减少了页面跳转。 你可以将 ", jsx(_components.code, {
        children: "revealOrder"
      }), " 设置为 ", jsx(_components.code, {
        children: "backwards"
      }), " 或 ", jsx(_components.code, {
        children: "together"
      }), "，", jsx(_components.code, {
        children: "backwards"
      }), " 将反转组件展示顺序，", jsx(_components.code, {
        children: "together"
      }), " 则会等待所有 Suspense 组件加载完毕。此外，还有一个 ", jsx(_components.code, {
        children: "tail"
      }), " 选项可以设置为 ", jsx(_components.code, {
        children: "hidden"
      }), " 或 ", jsx(_components.code, {
        children: "collapsed"
      }), "。这会覆盖显示所有回退的默认行为，要么不显示，要么显示按照 ", jsx(_components.code, {
        children: "revealOrder"
      }), " 设置的方向显示下一个。"]
    }), "\n", jsxs(_components.p, {
      children: ["我们的示例目前在加载占位符方面有点混乱。虽然它独立加载所有数据，但我们经常根据加载的订单数据显示多个占位。让我们将 ", jsx(_components.code, {
        children: "ProfilePage"
      }), " 组件的 JSX 包装在 ", jsx(_components.code, {
        children: "<SuspenseList>"
      }), " 中。"]
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: ["<", jsx(_components.span, {
          className: "hljs-title class_",
          children: "SuspenseList"
        }), " revealOrder=", jsx(_components.span, {
          className: "hljs-string",
          children: "\"forwards\""
        }), " tail=", jsx(_components.span, {
          className: "hljs-string",
          children: "\"collapsed\""
        }), ">\n  ", jsx(_components.span, {
          className: "xml",
          children: jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "ProfileDetails"
            }), " ", jsx(_components.span, {
              className: "hljs-attr",
              children: "user"
            }), "=", jsx(_components.span, {
              className: "hljs-string",
              children: "{props.user}"
            }), " />"]
          })
        }), "\n  ", jsxs(_components.span, {
          className: "xml",
          children: [jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "Suspense"
            }), " ", jsx(_components.span, {
              className: "hljs-attr",
              children: "fallback"
            }), "=", jsx(_components.span, {
              className: "hljs-string",
              children: "{"
            }), "<", jsx(_components.span, {
              className: "hljs-attr",
              children: "h2"
            }), ">"]
          }), "Loading posts...", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "h2"
            }), ">"]
          }), "}>\n    ", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "ProfileTimeline"
            }), " ", jsx(_components.span, {
              className: "hljs-attr",
              children: "posts"
            }), "=", jsx(_components.span, {
              className: "hljs-string",
              children: "{props.posts}"
            }), " />"]
          }), "\n  ", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "Suspense"
            }), ">"]
          })]
        }), "\n  ", jsxs(_components.span, {
          className: "xml",
          children: [jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "Suspense"
            }), " ", jsx(_components.span, {
              className: "hljs-attr",
              children: "fallback"
            }), "=", jsx(_components.span, {
              className: "hljs-string",
              children: "{"
            }), "<", jsx(_components.span, {
              className: "hljs-attr",
              children: "h2"
            }), ">"]
          }), "Loading fun facts...", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "h2"
            }), ">"]
          }), "}>\n    ", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "ProfileTrivia"
            }), " ", jsx(_components.span, {
              className: "hljs-attr",
              children: "trivia"
            }), "=", jsx(_components.span, {
              className: "hljs-string",
              children: "{props.trivia}"
            }), " />"]
          }), "\n  ", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "Suspense"
            }), ">"]
          })]
        }), "\n</", jsx(_components.span, {
          className: "hljs-title class_",
          children: "SuspenseList"
        }), ">\n"]
      })
    })]
  });
}
function MDXContent(props = {}) {
  const {wrapper: MDXLayout} = props.components || ({});
  return MDXLayout ? jsx(MDXLayout, Object.assign({}, props, {
    children: jsx(_createMdxContent, props)
  })) : _createMdxContent(props);
}

export { MDXContent as default, toc };
//# sourceMappingURL=lesson-ac408d8e.js.map
