Skip to content

pantoken-root / formats/scope/src / createScope

函数: createScope() ​

createScope(element, options?): PantokenScope

Beta

在 element 处创建一个以其为根的作用域。

参数 ​

element ​

HTMLElement

options? ​

CreateScopeOptions = {}

返回值 ​

PantokenScope

示例 ​

一个页面上的两个独立主题

ts
import { createScope } from "@pantoken/scope";

createScope(document.querySelector("#app")!, { theme: "rebrand", scheme: "dark" });
createScope(document.querySelector("#preview")!, {
  instanceId: "preview",
  theme: "canvas",
  scheme: "light",
  boundary: true,
});