Skip to content

ViewTansitionAPI使用

参考: https://juejin.cn/post/7269388083342082107

js
function spaNavigate(data) {
  // Fallback for browsers that don't support this API:
  if (!document.startViewTransition) {
    updateTheDOMSomehow(data);
    return;
  }

  // With a transition:
  document.startViewTransition(() => updateTheDOMSomehow(data));
}

效果

采用 Apache-2.0 license 协议